TorqueScript Reference
|
Functions | |
String | firstWord (sourceString) |
String | getField (sourceString, index) |
Integer | getFieldCount (sourceString) |
String | getFields (sourceString, index[, endindex]) |
String | getRecord (sourceString, index) |
Integer | getRecordCount (sourceString) |
String | getRecords (sourceString, index[, endindex]) |
String | getUnit (sourceString, index, separator) |
Integer | getUnitCount (sourceString, separator) |
String | getWord (sourceString, index) |
Integer | getWordCount (sourceString) |
String | getWords (sourceString, index[, endindex]) |
String | NextToken (tokenList, tokenVar, delimeter) |
String | removeField (sourceString, index) |
String | removeRecord (sourceString, index) |
String | removeWord (sourceString, index) |
String | restWords (sourceString) |
String | setField (sourceString, index, replace) |
String | setRecord (sourceString, index, replace) |
String | setUnit (sourceString, index, replace, separator) |
String | setWord (sourceString, index, replace) |
String firstWord | ( | sourceString | ) |
Use the firstWord function to retrieve the first word found in sourceString.
sourceString | A string containing one or more words. |
String getField | ( | sourceString | , |
index | |||
) |
Integer getFieldCount | ( | sourceString | ) |
Use the getFieldCount function to get the number of fields in sourceString.
sourceString | A string containing one or more fields. |
String getFields | ( | sourceString | , |
index | [, endindex] | ||
) |
Use the getFields function to retrieve a set of fields from a sourceString.
sourceString | A string containing one or more fields. |
index | The index of the first field to retrieve. |
endindex | The index of the final field to retrieve. |
String getRecord | ( | sourceString | , |
index | |||
) |
Use the getRecord function to get the record at index in sourceString.
sourceString | A string containing one or more records. |
Integer getRecordCount | ( | sourceString | ) |
Use the getRecordCount function to get the number of records in sourceString.
sourceString | A string containing one or more records. |
String getRecords | ( | sourceString | , |
index | [, endindex] | ||
) |
Use the getRecords function to retrieve a set of records from a sourceString.
sourceString | A string containing one or more records. |
index | The index of the first record to retrieve. |
endindex | The index of the final record to retrieve. |
String getUnit | ( | sourceString | , |
index | , | ||
separator | |||
) |
Integer getUnitCount | ( | sourceString | , |
separator | |||
) |
String getWord | ( | sourceString | , |
index | |||
) |
Integer getWordCount | ( | sourceString | ) |
Use the getWordCount function to get the number of words in sourceString.
sourceString | A string containing one or more words. |
String getWords | ( | sourceString | , |
index | [, endindex] | ||
) |
Use the getWords function to retrieve a set of words from a sourceString.
sourceString | A string containing one or more words. |
index | The index of the first word to retrieve. |
endindex | The index of the final word to retrieve. |
String NextToken | ( | tokenList | , |
tokenVar | , | ||
delimeter | |||
) |
Use the nextToken function to get the first token found in tokenList, where tokens are separated by the character(s) specified in delimeter. The token itself is stored in a variable whose name is specified in tokenVar. This function provides complex power in a simple package. Please read the notes below, they are very important. This function is scope-smart. That is, when we specify the name of the variable to store a token in by passing a value in tokenVar, we do not include either a local symbol (%), or a global symbol ($). We just pass in an un-adorned name, let's say \George. Then, depending on where this function is called, \George\ will become a local (George), or a global ($George) variable. If this function is called within a function or method definition, \George\ will be local (George). If this function is called from the file-scope (executed as part of a file and not within the scope of a function or method), \George\ will become a global ($George). There is one additional special case. If you attempt to use this from the console command line, the token will vaporize and no variable will be created
tokenList | The string containing token(s). |
tokenVar | The 'name' of the variable to store the token in. |
delimeter | The character(s) to use as a delimeter. A delimeter may be a single character, or a sequence of characters. |
String removeField | ( | sourceString | , |
index | |||
) |
Use the removeField function to remove a single indexed field from a sourceString.
sourceString | A string containing one or more fields. |
index | The index of the field to remove. |
String removeRecord | ( | sourceString | , |
index | |||
) |
Use the removeRecord function to remove a single indexed record from a sourceString.
sourceString | A string containing one or more records. |
index | The index of the record to remove. |
String removeWord | ( | sourceString | , |
index | |||
) |
Use the removeWord function to remove a single indexed word from a sourceString.
sourceString | A string containing one or more words. |
index | The index of the word to remove. |
String restWords | ( | sourceString | ) |
Use the restWords function to retrieve all words after the first word in sourceString.
sourceString | A string containing one or more words. |
String setField | ( | sourceString | , |
index | , | ||
replace | |||
) |
Use the setField function to replace an existing field with a new field(s), or to add field(s) to a string..
sourceString | A string containing one or more fields. |
index | The index of the field to remove. |
replace | The new field(s) to replace the field at index with. |
String setRecord | ( | sourceString | , |
index | , | ||
replace | |||
) |
Use the setRecord function to replace an existing record with a new record(s), or to add record(s) to a string..
sourceString | A string containing one or more records. |
index | The index of the record to remove. |
replace | The new record(s) to replace the record at index with. |
String setUnit | ( | sourceString | , |
index | , | ||
replace | , | ||
separator | |||
) |
String setWord | ( | sourceString | , |
index | , | ||
replace | |||
) |
Use the setWord function to replace an existing word with a new word(s), or to add word(s) to a string..
sourceString | A string containing one or more words. |
index | The index of the word to remove. |
replace | The new word(s) to replace the word at index with. |