split string by sscanf ?
#3

pawn Код:
new id;
sscanf(inputtext[3], "p<]>d{s[50]}", id);
inputtext will be "[ID842] Infernus"
inputtext[3] will skip the first 3 characters and be "842] Infernus"
the trick is to split using ] delimiter "p<]>" instead of space, so it separates into two parts "842" and "Infernus"
"d" specifier will be for the first part and will be stored in `id` variable.
"{s[50]}" is called quiet string and will be ignored. Anything inside { } are not stored in variables.
Reply


Messages In This Thread
split string by sscanf ? - by 3417512908 - 28.10.2018, 05:37
Re: split string by sscanf ? - by 3417512908 - 28.10.2018, 05:42
Re: split string by sscanf ? - by Calisthenics - 28.10.2018, 07:49
Re: split string by sscanf ? - by 3417512908 - 28.10.2018, 08:33
Re: split string by sscanf ? - by Calisthenics - 28.10.2018, 08:39
Re: split string by sscanf ? - by 3417512908 - 28.10.2018, 10:24

Forum Jump:


Users browsing this thread: 1 Guest(s)