01.01.2010, 04:21
Useful string & charcter uppercase and lowercase functions
Usage:
Usage:
Usage:
Usage:
Happy coding and have a happy new years,
Ethan
pawn Код:
stock bool:isupper(c)
{
if (c >= 65 && c <= 90)
return true;
return false;
}
Код:
isupper( char ) - returns true if the char is uppercase, returns false if not
pawn Код:
stock strtolower(str[])
{
for (new i = 0, j = strlen(str); i < j; i++)
{
if (isupper(str[i]))
str[i] += 32;
}
}
Код:
strtolower( "StRiNg" ) - translates the uppercase chars to lowercase - does not return a specific value
pawn Код:
stock bool:islower(c)
{
if (c >= 97 && c <= 122)
return true;
return false;
}
Код:
islower( char ) - returns true if the char is lowercase, returns false if not
pawn Код:
stock strtoupper(str[])
{
for (new i = 0, j = strlen(str); i < j; i++)
{
if (islower(str[i]))
str[i] -= 32;
}
}
Код:
strtoupper( "StRiNg" ) - translates the lowercase chars to uppercase - does not return a specific value
Ethan