Converting to string to integers?
#1

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.
Reply
#2

I find the usage of strval the most efficient way .



I hope that I have helped .
Reply
#3

strval(string[]); - convert a string into an integer.

This is the most efficient way i know.
Reply
#4

Then why some people use sscanf ?
Reply
#5

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.
Reply
#6

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 .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)