CStrTok Class Description


The CStrTok class is used to parse a target string into shorter strings bounded by separator characters. This process is known as "tokenizing". For example, a string might contain 10 values separated by commas which must be split into 10 pieces, or "token". Any number of separator characters may be specified. To parse the string into tokens, use the Next method to return each piece until it returns nil indicating no more pieces exist. This class works like the C language strtok() function.

Usage

Construction

Object = new_strtok()

Object = CStrTok:new()

Destruction

Object:delete()

Creation - Non-class Functions

This function is normally used to create a new CStrTok object as an alternative to the class-based new method.

new_strtok

Global function that creates a new CStrTok object.

Construction and Destruction - Class Methods

new

Creates a new instance of a CStrTok object. Various constructors are available. The target string and delimiters may be specified in the constructor.

delete

Deletes the instance of the CStrTok object.

Operations

Init

Initializes the target string and delimiters. You also can do this in the new method when you create an instance of the class.

SetDelimiter

Specifies the character delimiters to use henceforth while tokenizing the target string. The delimiter is initially set using new or Init, but this method allows you to change it while the string is being parsed.

Next

Returns the next string token.

Related Topics

Script Classes

 


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