CStrTok:Next
The Next method steps through the target string, returning the next token from the target string. If there are no more tokens remaining, nil is returned. As each piece of the target string is parsed, you use it or you might store it in an array for later use (see the Example, below).
sStr = CStrTok:Next()
sStr is the next string token from the target string.
The following script parses the string sStr into pieces delimited by ", \t" (comma, blank, and tab characters). In this example, the pieces are stored in a table (an array) named A for later use.
|
-- create a new CStrTok object initialized to the target |
|
-- string sStr and the delimiters. |
|
-- create table A to hold the string tokens |
|
-- start index with no tokens counted |
|
-- loop until there are no more tokens |
|
-- get the next token |
|
-- if a token exists |
|
-- advance to the next table index |
|
-- add the token string to the table |
|
|
|
-- no more tokens, break out of the loop |
|
-- end of test |
|
-- end of parsing loop |
|
-- work with the string pieces in array A. |
|
-- delete the object and its associated memory. |
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.