TYL PROGRAMMING LANGUAGE
▶ STRING MODULE REFERENCE
string.chars text → characters
text
string variable
characters
list of all characters in text
string.contains text searchtext startindex endindex → result
Searches for searchtext in text. If found, sets startindex and endindex and returns TRUE, otherwise FALSE.
text
string variable
searchtext
string to search in text
startindex
the starting index of searchtext in text
endindex
the index at the end of searchtext in text
string.end text searchtext → result
Checks if text ends with searchtext.
text
string variable
searchtext
string to search in text
result
boolean variable
string.index text searchtext → position
Searches for searchtext in text. If found, returns the starting index of searchtext in text, otherwise returns -1.
text
string variable
searchtext
string to search in text
string.insert text position inserttext → result
If position is less than text length, inserts inserttext to text at position and returns the result, otherwise returns NULL.
text
string variable
position
integral number
inserttext
string to search in text
string.lines text → lines
text
string variable
lines
list of all lines in text
string.lower text → result
text
string variable
result
lowercased text
string.replace text searchtext replacetext → result
Searches for searchtext in text. If found, replaces all occurrences of searchtext in text, with replacetext.
text
string variable
searchtext
string to search in text
replacetext
replace string
string.section text position length → section
If position plus length is less than text length, returns the section of text that starts at position and ends at position plus length. If length is ommited, returns the section of text that starts at position. Otherwise, returns an empty string.
text
string variable
position
integral number
length
integral number (optional)
string.split text splitchar → strings
Splits text by splitchar and returns list of strings. Each string in the list have at least one non breaking space character. For ex., if text is 'AB * **C D*', then splitting by the asterisk character '*', will yield the list ['AB ', 'C D'].
text
string variable
splitchar
character that's used for text splitting
strings
list of all splitted strings in text
string.start text searchtext → result
Checks if text starts with searchtext.
text
string variable
searchtext
string to search in text
result
boolean variable
string.trim text
The system will remove all non breaking space charcters from the start and the end of text.
text
string variable
string.upper text → result
text
string variable
result
uppercased text
string.words text → words
text
string variable
words
list of all words in text