Class: String
Description
This method returns the length of a string.
If the delimiter is absent, this method returns the character length of the string (number of characters in the string).
If the delimiter is present the method returns the number of non-overlapping occurrences of delimiter in the string +1 (the number of delimiter-separated fields). If delimiter.length()=0, the returned value will be 0 (zero).
This method replaces the $LENGTH() function.
Syntax
StringObject.length(String delimiter)
Parameters
delimiter |
The delimiter used to count subfields. |
Returns
A Number.
When Became Available
v7.0
Example
type String STR = "in Maine it's raining cats and dogs"
type Number LEN = STR.length() // 35
// (almost) NEVER the same as the previous example
type Number ZERO = STR.length("") // 0
// number of words in this sentence ("it's" is single word)
type Number WORDS = STR.length(" ") // 7
// using a multi-character delimiter
type Number INS = STR.length("in") // 5