note 32637 deleted from function.ucfirst by nlopess
| From: | nlopess@php.net | Date: | Tue, 02 Mar 2004 15:29:37 +0000 |
| Subject: | note 32637 deleted from function.ucfirst by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66114@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Well this is a lil function to up the first characters even if its not a locale, prolly a simpler
way to do this but still... it works :P
function Upper($str){
$i=0;
/*
$not_locale_bank_up = Is the replacement character(s)
$not_locale_bank_down = Is the character(s) to search for
*/
$not_locale_bank_up="ABCDEFGHIJKLMNOPQRSTUVXYZÅÄÖ";
$not_locale_bank_down="abcdefghijklmnopqrstuvxyzåäö";
while(strlen($not_locale_bank_up)>=$i){
if(substr($str, 0, 1)==substr($not_locale_bank_down, $i, 1)){
$rep=substr($not_locale_bank_up,$i, 1);
$string=substr_replace($str,$rep, 0, 1);
break;
}
$i++;
}
return $string;
}
//test
$str="äta bullar med sylt";
echo Upper($str);
- mjou