CStrTok:Init


The Init method initializes the CStrTok object to a target string and list of delimiters. This is usually done when the CStrTok object is constructed using new. Use the Init method when you want to change the string or delimiters for an existing CStrTok object or when you created the object using the default new without passing any arguments.

Syntax

CStrTok:Init( sStr, sDelim )

bullet.gif    sStr is the target string.

bullet.gif    sDelim is a string containing the delimiter characters.

Example

The following script parses two strings sStr and sNewStr into pieces delimited by delimiter characters sDelim. This also could be done using two instances of CStrTok.

sDelim = ", \t\r\n"

-- delimiters comma, blank, tab, new line, and return

T = new_strtok( sStr, sDelim )

-- create a new CStrTok object initialized to the target

 

-- string sStr and delimiters sDelim

...

-- parse sStr and work with it

 

 

T:Init( sNewStr, sDelim )

-- change to a new string

 

 

  ...

-- parse the new string and work with it

T:delete()

-- delete the object and its associated memory.

Related Topics

CStrTok, new, Next, SetDelimiter


Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.