language-extensions/R/src/Utilities.cpp
//--------------------------------------------------------------------------------------------------
// Name: Utilities::Tokenize
//
// Description:
//  Splits the given character string using the delimiter and
//  adds the tokens to the input vector.
// Remarks:
//  If the input is invalid and unable to be parsed,
//  token will be nullptr and we add nothing to the vector.
//
// Returns:
//  nothing.
//
:Tokenize
Description:
Splits the given character string using the delimiter and
adds the tokens to the input vector.
Remarks:
If the input is invalid and unable to be parsed,
token will be nullptr and we add nothing to the vector.

nothing.
: Tokenize Description : Splits the given character string using the delimiter and adds the tokens to the input vector . Remarks : If the input is invalid and unable to be parsed token will be nullptr and we add nothing to the vector . nothing .
void Utilities::Tokenize(
	char           *input,
	const char     *delimiter,
	vector<char *> *tokens)
{
	char *internalState = nullptr;
	char *token = strtok_r(input, delimiter, &internalState);
	while (token != nullptr)
	{
		(*tokens).push_back(token);
		token = strtok_r(nullptr, delimiter, &internalState);
	}
}
void Utilities :: Tokenize ( char * input , const char * delimiter , vector < char * > * tokens ) { char * internalState = nullptr ; char * token = strtok_r ( input , delimiter , & internalState ) ; while ( token != nullptr ) { ( * tokens ) . push_back ( token ) ; token = strtok_r ( nullptr , delimiter , & internalState ) ; } }
Name: Utilities::Tokenize
Description:
Splits the given character string using the delimiter and
adds the tokens to the input vector.
Name : Utilities :: Tokenize Description : Splits the given character string using the delimiter and adds the tokens to the input vector .
// Use strtok_r iteratively to do the tokenization. //