find next 6 numbers
#1

Hello everyone, i am trying to make converter using pawno, not object converter.
and i wanna string find text then i wanna save the value of the next 7 numbers after the text, for example:
pawn Код:
if(strfind("Pos=1000.000","Pos",true) != -1 )
                {
                    format(string[2],sizeof string[2],"%0.5f",TheNext9LettersAfterPos=);
                }
Is that possible ?
like i wanna replace pos=1000.000 with 1000.000.
Thanks for reading
Reply
#2

%0.5f ??
Reply
#3

Quote:
Originally Posted by JM_Millers
Посмотреть сообщение
%0.5f ??
ya, i wanna save the float on that string.
Reply
#4

Quote:
Originally Posted by ******
Посмотреть сообщение
This is the sort of thing that sscanf is for:

"'Pos='a<f>[5]"
I am using sscanf that will be good,but Can you give example please ?
Reply
#5

Quote:
Originally Posted by ******
Посмотреть сообщение
What was wrong with the example I already gave?
I mean should it be like that ? and what is 'a' in 'PosZ='a<f>[5]?
pawn Код:
if(!sscanf(string,"'PosZ='a<f>[5]",zPosStr) && !sscanf(str0,"'PosX='a<f>[5]",xPosStr))
Reply
#6

Quote:
Originally Posted by ******
Посмотреть сообщение
The various specifiers are all well documented in the sscanf topic.
Aha, okey thanks.
One more question,
pawn Код:
!sscanf(string,"'PosZ='a<f>[5]",zPosStr)
This will save the float in the variable ? if no then how to save that float in a variable?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)