Lower case detection.
#1

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

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

Reply
#3

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'
Reply
#4

thanks
Reply
#5

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)