Detect Last Letter of Player's Name/or any 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: Detect Last Letter of Player's Name/or any string (
/showthread.php?tid=556776)
Detect Last Letter of Player's Name/or any string -
Garavel - 11.01.2015
Basically, how do I reach and store last letter of a string?
For example, your name is John_Smit
h, how do I make the script detect "H" at the very end and store it?
I found and tried
new len = strlen(string);
printf("%c", string[len - 1]);
but it didn't seem to work.
Re: Detect Last Letter of Player's Name/or any string -
rickisme - 11.01.2015
pawn Код:
new string[32] = { "This is string" };
printf("%s is last character of %s", string[strlen(string) - 1], string);
Re: Detect Last Letter of Player's Name/or any string -
Garavel - 11.01.2015
Thank you