Converting to string to integers? - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Converting to string to integers? (
/showthread.php?tid=402122)
Converting to string to integers? -
deffo - 25.12.2012
What are different methods of converting a string to an integer ? Which is the most efficient way ?
Note: Only name of methods/functions needed, not much details.
Re: Converting to string to integers? - rjjj - 25.12.2012
I find the usage of
strval the most efficient way
.
I hope that I have helped
.
Re: Converting to string to integers? -
BlackBank - 25.12.2012
strval(string[]); - convert a string into an integer.
This is the most efficient way i know.
Re: Converting to string to integers? -
deffo - 25.12.2012
Then why some people use sscanf ?
Re: Converting to string to integers? -
BlackBank - 25.12.2012
Quote:
Originally Posted by deffo
Then why some people use sscanf ?
|
With sscanf you can split/explode the string into pieces, and put the pieces into a variable/an other array.
Re: Converting to string to integers? - rjjj - 25.12.2012
Quote:
Originally Posted by deffo
Then why some people use sscanf ?
|
If it is only used for converting strings to integers, probably because it is known as an efficient function
.
Well, those standard functions of Pawn are very fast and
sscanf has to verify things, like the specifiers, before accomplishing the conversion.
I hope that I have helped
.