Strtok() questions

Hi,

I have a string coming into serial
+CLIP: "1234567890",129,"",0,"",0

I wanna use strtok with delimiter ". How can i use strtok to search for " since using const char delimiter[] = " " "; will output this error: Compilation error: missing terminating " character

thanks

Hello dummyguy

Welcome to the worldbest Arduino forum ever.

Post your sketch, well formated, with well-tempered comments and in so called
code tags "< code >" to see how we can help.

Have a nice day and enjoy coding in C++.

I have no code... i m just testing different ways of parsing that incoming string ... strtok looks very good but how to use " is what i got in trouble with.

Me too.

Have a nice day and enjoy coding in C++.

i bet if i give you a bit of code you go afk !

i don t have any issue with a specific code ... i asked how can i use " delimiter in a strtok function. looks like you read questions same way how you answear...

char * strtok ( char * str, const char * delimiters );

Split string into tokens

Try: delimiter[] = " " ";

not working ... tried that 1st thing :slight_smile:

what seems to work but i don t know if is right ... is const char delimiter[] = " \ " \ " "; without spaces inside "" used spaces here on forum

Unfortunately I forgot the code tags and the forum changed what I wrote:
delimiter[] = " \" ";

as you posted will not create tokes with " delimiter... idk why my version works ...

oh yes... sorry it works your version too ... if you kind can you explain how my version works too ?:)))

The \ prevents the compiler from interpreting the " as a string ending.

googled about it and got so confused... your answer is in beginner terms! tx a lot , i understand now!

You're welcome.

Indeed.

The \ is known as the escape character - it is used for creating a number of things that you can't just type: