SA-MP Forums Archive
Lower case detection. - 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: Lower case detection. (/showthread.php?tid=659895)



Lower case detection. - Exhibit - 19.10.2018

How can I check if a string's first letter is lower case? Thanks


Re: Lower case detection. - DarkBr - 19.10.2018

PHP Code:
new str[] = "Hello world";
if(!(
'A' <= str[0] <= 'Z'))
{
    
/*
        <Lowercase>
        But 'H' is uppercase, so here it will not be called
    */




Re: Lower case detection. - Threshold - 20.10.2018

Quote:
Originally Posted by DarkBr
View Post
PHP Code:
new str[] = "Hello world";
if(!(
'A' <= str[0] <= 'Z'))
{
    
/*
        <Lowercase>
        But 'H' is uppercase, so here it will not be called
    */

That code doesn't consider symbols and non-alphanumeric characters.

The easiest way for this is the most simple.

PHP Code:
if('a' <= str[0] <= 'z'



Re: Lower case detection. - Exhibit - 20.10.2018

thanks


Re: Lower case detection. - GTLS - 21.10.2018

Although your question is answered, I'd like to suggest this String Library which includes other useful functions aswell.
https://sampforum.blast.hk/showthread.php?tid=622917