note 32637 added to function.ucfirst

From: Date: Tue, 03 Jun 2003 17:09:44 +0000
Subject: note 32637 added to function.ucfirst
Groups: php.notes 
Request: Send a blank email to php-notes+get-49633@lists.php.net to get a copy of this message
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 ---- Manual Page -- http://www.php.net/manual/en/function.ucfirst.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+32637 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+32637&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+32637&report=yes

« previous php.notes (#49633) next »