A few days ago

what are the examples of strtok which delimits the space and commas but also token the comma?

commas and spaces are delimited but the commas are also put in a token

Top 2 Answers
A few days ago
Vernix Lanugo

Favorite Answer

I’m not sure if I understand the Q but is “hyphen” any help?

A few days ago
This is a computer science question, not a “Words and Wordplay” question, but I’ll take a stab at it.

If I understand your question properly, you have a text which includes spaces and commas, and you want to tokenize the text using both the commas and the spaces as delimiters (i.e. you want the individual words) BUT, you want to include commas in the resulting tokens that were originally followed by a comma in the text.

If not all of the commas are followed by spaces, this will be difficult, as the tokenize function works in place and will replace the delimiter character with a null (thus terminating the string). In order to include the comma in the resulting token, you’ll need to ADD the required space first, so it can then be turned into a null.

You’re best bet is to convert all commas which are NOT followed by spaces to commas with a following space, and then use the STRTOK function using only the space character as a delimiter.