|
|
|
|
| Author: legacy information 25.06.02 17:11:21 |
Tokenize Parses a string to retrieve values stored in the form of a list delimited by a single character. String Tokenize(String strMainString, String strToken, char cDelimiter); Parameters
Return Value A string value for the substring retrieved. Returns 0 if token is not found. NOTE: The script considers the string "0" as equal to the integer 0. Therefore, in order to store values of "0", a special check is required. Add an integer 1" to the beginning of the return value and if it was a string "0", the result will be a string "10". If it was an integer 0, the result will be an integer 1.
Remarks Parses a string to retrieve values stored in the form of a list delimited by a single character. If a 0 is passed as the second argument, the first substring is returned. Then, if the first substring is passed as the second argument in a subsequent call, the next substring in the list is returned. NOTE: The list cannot contain identical values using this method of substring retrieval. But there is a workaround described below. One way in which this function can be used as a list that allows identical values to be stored is to allow a mainstring to contain substrings that are associated with tokens. Each substring and token pair are delimited from others using the delimiter character. An example mainstring could look like the followiing: "Token1|First Substring|Token2|Second Substring|..." Here, "Token1" and "Token2" are the tokens, "First Substring" and "Second Substring" are the substrings associated with them respectively, and '|' is the delimiter character. To obtain the second substring, simply pass the entire string as the mainstring, "Token2" as the token, and '|' as the delimiter to the Tokenize function.
Example
© Interplay, from Klingon Academy scripting documentation |