SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    *********! *********!!! jackli's Avatar
    Join Date
    Sep 2005
    Posts
    436
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Detect if character is upper or lowercase

    Is there a PHP function that detects if a specific character in string is lower/upper case? If not, what's the best way to do this?

  2. #2
    SitePoint Evangelist priti's Avatar
    Join Date
    Aug 2006
    Location
    India
    Posts
    488
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jackli View Post
    Is there a PHP function that detects if a specific character in string is lower/upper case? If not, what's the best way to do this?
    Till now i have not seen any inbuilt PHP function like issupper or islower() but i think you can do it as below.If you have to check the string of characters.

    function isupper($i)
    {
    return (strtoupper($i) === $i);
    }

  3. #3
    SitePoint Guru mmarif4u's Avatar
    Join Date
    Dec 2006
    Location
    /dev/swat
    Posts
    619
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If u r using login script or some thing like that.
    Than in ur query just specify the field as BINARY.
    It will do the trick.

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Alternative to priti's code you can also find like this too:
    PHP Code:
    $string "helLo";
    for(
    $i=0;$i<strlen($string);$i++){
        if(
    ord($string[$i]) >= 65 && ord($string[$i]) <= 90){
            echo 
    $string[$i] . "= Upper case <br>";
        }
        else{
            echo 
    $string[$i] . "= Lower case <br>";
        }

    Apply in your case.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

  6. #6
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog View Post
    Never try to look for such functions. Thanks stereofrog !!

    Lol!
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •