[SOLVED] String tokenizer by delimeter
#1

Hi!
I'd need a string tokenizer, which need a delimeter!
Please give me a function and an example.

Thanks!

Edit: It's solved!

sscanf is the answer =).
Reply
#2

https://sampwiki.blast.hk/wiki/Sscanf_code
Reply
#3

I tried this, but I didn't find a good example :/
Can't u show me one, please?
Reply
#4

So anyone, please give me an example where can I set the delimeter (sscanf) :/
Reply
#5

https://sampwiki.blast.hk/wiki/Fast_Commands

look at the heal/ban/givecash commands
Reply
#6

will this work?
pawn Код:
new string[256], str1[128], str2[128], str3[128];
format(string, 256, "Test|Test2|Test3#");
if(sscanf(string, "s|s|s", str1, str2, str3) == 0) {
    printf("STR1:%s STR2:%s STR3:%s ", str1, str2, str3);
}
Reply
#7

pawn Код:
if(sscanf(string, "p|sss", str1, str2, str3)
Quote:

will this work?

Well, try it !
Reply
#8

Quote:
Originally Posted by dice7
pawn Код:
if(sscanf(string, "p|sss", str1, str2, str3)
Quote:

will this work?

Well, try it !
It works, so big thanks!
I neded it, cuz I wrote a tokenizer but it started to get so crazy :/.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)