It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Checking for lowercase and/or uppercasing

Checking for lowercase and/or uppercasing

Postby Enjoii on Sun Apr 06, 2008 11:31 pm

I'm creating something where I need to check a string to see if it has either a lowercase or uppercase letter. I'm wondering how I would check a string for a lowercase letter (it being any alphabetical letter) or uppercase. Any help will be appreciated, thanks.
- tb
Enjoii
 
Posts: 2
Joined: Sun Apr 06, 2008 11:28 pm

Postby Enjoii on Mon Apr 07, 2008 1:12 am

Nevermind I have figured out how to do it by using char... I remembered the function after another language. Heres the code for anyone who needs it:

Code: Select all
        function doesContainLowerCase(data){ // chars: 97-to-122
         var found;
         for(d=0;d<data.length;d++){
          for(i=97;i<122;i++){
           charToChk = String.fromCharCode(i);
            if(data.charAt(d)==charToChk){found=1;break;}else{found=0;}
          }
          if(found==1){break;}
         }
         return found;
        }
       
        function doesContainUpperCase(data){ // chars: 65-to-90
         var found;
         for(d=0;d<data.length;d++){
          for(i=65;i<90;i++){
           charToChk = String.fromCharCode(i);
            if(data.charAt(d)==charToChk){found=1;break;}else{found=0;}
          }
          if(found==1){break;}
         }
         return found;
        }
Enjoii
 
Posts: 2
Joined: Sun Apr 06, 2008 11:28 pm


Who is online

Users browsing this forum: No registered users and 5 guests