function
#1

Hi, maybe someone have a good idea how to create function which would check if there are numbers and letters in string?

I have idea for this, but its long
Reply
#2

This checks if string is numeric,
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
Reply
#3

Late...(forums don't warn you no more if someone has posted while you were writing)
Reply
#4

Quote:
Originally Posted by EliranPesahov
Посмотреть сообщение
This checks if string is numeric,
pawn Код:
IsNumeric(const string[])
{
    for (new i = 0, j = strlen(string); i < j; i++)
    {
        if (string[i] > '9' || string[i] < '0') return 0;
    }
    return 1;
}
I think this will check is the string are integer.
Reply
#5

And what integer is? number.
Reply
#6

Cant understand, but nvm. So, the check sould be something like (IN DIALOG)

if(!strlen(inputtext)) && !IsNumeric(inputtext)
Reply
#7

No.

if(strlen(inputtext) && !IsNumeric(inputtext))
This checks if the string includes any text and it shouldn't include numbers to pass
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)