Len returns the length for an array, chan, map, slice or string. Otherwise it will return 0.
()
| 268 | // Len returns the length for an array, chan, map, slice or string. |
| 269 | // Otherwise it will return 0. |
| 270 | func (v *Value) Len() int { |
| 271 | switch v.getResolvedValue().Kind() { |
| 272 | case reflect.Array, reflect.Chan, reflect.Map, reflect.Slice: |
| 273 | return v.getResolvedValue().Len() |
| 274 | case reflect.String: |
| 275 | runes := []rune(v.getResolvedValue().String()) |
| 276 | return len(runes) |
| 277 | default: |
| 278 | logf("Value.Len() not available for type: %s\n", v.getResolvedValue().Kind().String()) |
| 279 | return 0 |
| 280 | } |
| 281 | } |
| 282 | |
| 283 | // Slice slices an array, slice or string. Otherwise it will |
| 284 | // return an empty []int. |
no test coverage detected