Comaparing a String with a Variable
#2

Quote:
Originally Posted by JeNkStAX
Is there anyway to compare a String with a Variable?
Returns 0 if the var and the string are the same.
pawn Код:
StrFloatCmp(str:String, Float:Float, Chars) // Float is the float to compare, chars is the number of characters to compare
{
    new StrFloat[10];
    format(StrFloat, sizeof(StrFloat), "%f", Float);
    if (strcmp(StrFloat, String, true, Chars) == 0) return 0;
    return 1;
}

StrIntCmp(str:String, int:Integer, Chars) // Float is the float to compare, chars is the number of characters to compare
{
    new StrInt[10];
    format(StrInt, sizeof(StrInt), "%i", Integer);
    if (strcmp(StrInt, String, true, Chars) == 0) return 0;
    return 1;
}
Reply


Messages In This Thread
Comaparing a String with a Variable - by ICECOLDKILLAK8 - 01.02.2009, 22:41
Re: Comaparing a String with a Variable - by Ghett0 - 01.02.2009, 22:57
Re: Comaparing a String with a Variable - by ICECOLDKILLAK8 - 01.02.2009, 23:08
Re: Comaparing a String with a Variable - by Donny_k - 02.02.2009, 03:45
Re: Comaparing a String with a Variable - by Ghett0 - 02.02.2009, 15:21
Re: Comaparing a String with a Variable - by yom - 02.02.2009, 15:32
Re: Comaparing a String with a Variable - by ICECOLDKILLAK8 - 02.02.2009, 16:06
Re: Comaparing a String with a Variable - by yom - 02.02.2009, 16:10
Re: Comaparing a String with a Variable - by ICECOLDKILLAK8 - 02.02.2009, 16:12
Re: Comaparing a String with a Variable - by yom - 02.02.2009, 16:19

Forum Jump:


Users browsing this thread: 3 Guest(s)