HasMoreTokens(struct sStringTokenizer)

Check to see if any more tokens remain. Returns FALSE if not, TRUE if so.

int HasMoreTokens(
    struct sStringTokenizer stTok
);

Parameters

stTok

The string tokenizer used to split up the string.


Description

This function checks whether the tokenizer stTok, which is used to split up the string, has more tokens remaining. If so, it returns TRUE, otherwise FALSE.



Remarks

This function actually checks the string length of the remaining substring that has not yet been tokenized. If the remaining string length is zero, it returns FALSE; otherwise TRUE.

Note that the tokenizer will return empty strings as valid tokens (and count them as valid tokens), for any occurrence of two adjacent delimiters within the original string. It will also return an empty string as a valid token (and count it as a valid token), when there is a (single) delimiter at the beginning or the end of the original string. However, if the original string is empty, HasMoreTokens() will always return FALSE and NOT count the empty string as a valid token.

Keep in mind that the functions in x0_i0_stringlib are not very efficient. They do a lot of unnecessary string manipulations and unnecessary string parameter passing; string operations and string parameter passing (into or out of nwnscript functions) are amongst the most inefficient operations in nwnscript.

For the purpose of string tokenization by the functions provided in x0_i0_stringlib, a token is any substring (including empty substrings!) within the original string enclosed by the specified delimiter (e.g. every token has one delimiter to the left, one to the right and NO delimiters within). Any non-empty original string is treated as if it were enclosed within a pair of (virtual) delimiters to its left and right. Thus, unless the original string is empty, the number of tokens is always one higher than the number of delimiters contained within the original string. A non-empty string with no delimiters therefore consists out of one token, which is equal to the original string. An empty string has no tokens, although an empty token will be returned on request.

Example:

sString = "I|am|sloppy||programmer";
sDelimiter = "|";

Token[0] = "I";
Token[1] = "am";
Token[2] = "sloppy";
Token[3] = "";
Token[4] = "programmer";

sString contains five tokens and four delimiters.


Requirements

#include "x0_i0_stringlib"


Version

???

See Also

functions:  AdvanceToNextToken | FindSubString | GetNextToken | GetNumberTokens | GetStringTokenizer | GetSubString | GetTokenByPosition
categories:  String Functions


author: motu99, editor: Mistress