CStrTok:new
The new method creates an instance of the CStrTok class. Note that the object can also be created using new_strtok.
Note: This method's name uses all lower case to present it as the analog of the C++ new operator. Generally, the names of class methods begin with an uppercase letter but new and delete are different.
S = CStrTok:new( strString, strTokens )
Creates a CStrTok object
S and
initializes it with the target string and the tokens. You can begin
calling Next to
parse the target string into tokens.
strString
is the string to parse.
strTokens
specified the tokens used to parse the string.
S = CStrTok:new()
Default constructor. The new
CStrTok S is not initialized.
You must call Init
before parsing the string.
S = CStrTok:new( CStrTok2 )
This
is a copy constructor. The new CStrTok S is initialized to the target string and
delimiters of the CStrTok instance.
On
success, a CStrTok object is created and returned.
On
failure, nil is
returned.
The following example shows the use of a constructor and destructor pair:
|
-- create a new CStrTok object initialized to the |
|
-- string sStr and delimiters comma, blank, and tab |
|
-- parse the string and save or use its pieces here |
|
-- delete the object and its associated memory. |
CStrTok , Init, Next, delete, new_strtok
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.