Deprecated Functions
The following String API functions have been deprecated.
string.charat
This API returns a string which contains a single character from the source string at the specified index.
Syntax
charAt()
Return Values
character [String]
Character at the specified index in the source string.
nil
index is lesser or greater than the length of the source string
Platform Availability
Available on all platforms.
string.compare
This API compares the contents of two strings numerically. For example, "Adam" is smaller than "adam" as per the ASCII table because A(65) is smaller than a(97).
Syntax
compare()
Return Values
Status [Number]
status of the compare operation
- 1 - s1 > s2
- 0 - s1 = s2
- -1 - s1 < s2
Platform Availability
Available on all platforms.
string.find
This API finds the first occurrence of the search string in the source string.
Syntax
indexOf()
Return Values
Start Position [Number]
The search string is found and the start position of the search string is returned
nil
The search string is not found
Platform Availability
Available on all platforms.
string.len
This API returns the length of the source string.
Syntax
length
Return Values
length [Number]
The value returned is the length of the source string
Rules and Restrictions
If the input string has an escape character in it, this API returns the length of the string as 0.
Platform Availability
Available on all platforms.
string.lower
This API changes the upper case characters of the source string to lower case characters.
Syntax
toLowerCase()
Return Values
lower case [String]
A string containing lower case characters is returned.
Platform Availability
Available on all platforms
string.replace
This API finds and replaces the occurrences of a string in the source string with a string you specify.
Syntax
replace()
Return Values
modified string [String]
All occurrences of the string specified in the find parameter are replaced with the string specified in the replace parameter
Platform Availability
Available on all platforms.
string.split
This API splits the source string based on the separator (default is comma) and returns a table containing the string.
Syntax
split()
Return Values
- A Table containing the string is returned.
Platform Availability
Available on all platforms.
string.sub
This API returns the substring of the source string.
Syntax
substring()
Return Values
substring [String]
The substring of the source string is returned.
If j is not given, the substring will begin from the character specified in i and ends at the end of the source string.
If j is given, the substring will begin from the character specified in i and ends at the character specified in j and includes j.
Platform Availability
Available on all platforms.
string.upper
This API changes the lower case characters of the source string to upper case characters.
Syntax
toUpperCase()
Return Values
upper case [String]
A string containing upper case characters is returned
Platform Availability
Available on all platforms.