Length of String Array Elements
- Last UpdatedOct 24, 2022
- 1 minute read
The length of the longest element in an array can be a useful thing to know, for example when you are outputting the values in table form. You can do this using the Width() method.
For example, in the array !LIST:
!LIST[1] 'One'
!LIST[2] 'Two'
!LIST[3] 'Three'
The command:
!Width = !List.width()
This would set !Width to the value 5, the length of the longest element in !LIST, which is 'Three'.
Note:
If the array contained elements that were not strings, these are ignored when calculating
the maximum width.