open.mp forum
[Pawn] How to convert string to int? - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] How to convert string to int? (/showthread.php?tid=2151)



How to convert string to int? - ViktorNas - 2021-07-04

Please tell me if there is any function that does this or how I could make a function that does this.


RE: How to convert string to int? - Radical - 2021-07-04

https://open.mp/en/docs/scripting/functions/strval


RE: How to convert string to int? - ViktorNas - 2021-07-04

Thanks dude.


RE: How to convert string to int? - Y_Less - 2021-07-04

sscanf is better, it has better error returns and deals with separators.


RE: How to convert string to int? - Pinch - 2021-07-05

(2021-07-04, 07:52 PM)Y_Less Wrote: sscanf is better, it has better error returns and deals with separators.

Good, you could create a (where not to) use sscanf tutorial tho, it's really not needed when only a single number is in question.. (simply isnumeric > value = strval)