SA-MP Forums Archive
Retrieve last character of a string - 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: Retrieve last character of a string (/showthread.php?tid=475262)



Retrieve last character of a string - Derryd - 12.11.2013

How do I retrieve the last character of a string?

For example: 100.553

Returns 3


Re: Retrieve last character of a string - Ada32 - 12.11.2013

strings loves null. so size - 2.

pawn Код:
myStr[] = "100.553",
lastCharacter = myStr[(sizeof(myStr)-2)];