Javascript Strings
Although the String object is not directly supported by Yate's Javascript these methods are applicable to most non-object variables.
Note that these are not real properties of strings and cannot be enumerated!
- length
Property that describes the length of a string as a decimal number.
Returns numeric length of string
x="abcd"; Engine.output(x.length); 4
- charAt(pos)
Function that returns a character at a certain 0-based position in string.
Returns a string containing a single character or empty if pos is out of bounds.
x="abcd"; Engine.output(x.charAt(3)); d
- indexOf(str)
Function that returns the position of a substring in another string.
Returns 0-based position of str or -1 if str is not found
x="abcd"; Engine.output(x.indexOf("bc")); 1
- substr(offs,len)
Function that returns a substring.
Returns a string that starts at 0-based position offs and has at most len characters
x="abcd"; Engine.output(x.substr(1,2)); bc
- substr(offs)
Function that returns a substring.
Returns a string that starts at 0-based position offs to the end of the original string
x="abcd"; Engine.output(x.substr(2)); cd
- match(reg)
Function that matches a string against a Regular Expression.
- toLowerCase()
Function that converts a string to lower case.
- toUpperCase()
Function that converts a string to upper case.
- trim()
Function that removes leading and trailing spaces from a string.
- sqlEscape()
Function that performs SQL escaping on a string.
- startsWith(str)
Function that checks if a string starts with a specific substring.
- endsWith(str)
Function that checks if a string ends with a specific substring.
- split(sep)
Function that splits a string into an Array at a separator.
- toString()
Function that converts a number to string using numbering base 10.
- toString(base)
-