Alphanumeric check - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Alphanumeric check (
/showthread.php?tid=268966)
Alphanumeric check -
XwawawaX - 14.07.2011
Hello,
is there any way to check if the string is only alphanumeric characters? I need this for password creation.
Re: Alphanumeric check - rjjj - 14.07.2011
Yes, there is a way
.
I did a function to you which do this, it should solve your problem
:
pawn Код:
stock OnlyAlphaNumericCharacters(const string[])
{
new z = 0;
for(new x, y = strlen(string); x != y; x++)
{
if((string[x] >= 48 && string[x] <= 57) || (string[x] >= 65 && string[x] <= 90) || (string[x] >= 97 && string[x] <= 122))
{
z++;
}
}
if(z == strlen(string)) return true;
else return false;
}
Maneer to use:
pawn Код:
new lol[3] = "xD";
if(OnlyAlphaNumericCharacters(lol)) print("The variable have only letters and/or numbers);
I hope that i have helped
.
Re: Alphanumeric check -
XwawawaX - 14.07.2011
Thank you <3