GetNextToken(struct sStringTokenizer)

Returns the token to which the string tokenizer is pointing.

string GetNextToken(
    struct sStringTokenizer stTok



The string tokenizer used to split up the string.


This function returns the token to which the string tokenizer stTok, which is used to split up the string, currently points to.

In order to return a sensible value, you first must have called AdvanceToNextToken.


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.


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.


#include "x0_i0_stringlib"



See Also

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

author: motu99, editor: Mistress