SA-MP Forums Archive
LowerToUpper. - 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: LowerToUpper. (/showthread.php?tid=383040)



LowerToUpper. - Edvin - 06.10.2012

Hi guys

Have anyone the function "LowerToUpper", like:

pawn Код:
#define UpperToLower(%1) for ( new ToLowerChar; ToLowerChar < strlen( %1 ); ToLowerChar ++ ) if ( %1[ ToLowerChar ]> 64 && %1[ ToLowerChar ] < 91 ) %1[ ToLowerChar ] += 32
Thanks.


Re: LowerToUpper. - [XST]O_x - 06.10.2012

pawn Код:
#define LowerToUpper(%1) for ( new ToUpperChar; ToUpperChar < strlen( %1 ); ToUpperChar ++ ) if ( %1[ ToUpperChar ]> 97 && %1[ ToUpperChar ] < 122 ) %1[ ToUpperChar ] -= 32



Re: LowerToUpper. - Vince - 06.10.2012

I do not know why some people want to push everything into a macro. If it contains the keywords if, else, for, while, etc, then by all means use a function!

pawn Код:
toUpper(text[])
{
    for(new i = strlen(text); i > 0; i--)
    {
        if('a' <= text[i] <= 'z')
            text[i] |= 0x20;
     }
}