note 53370 deleted from function.strtoupper by sobak

From: Date: Sat, 10 Dec 2016 11:16:24 +0000
Subject: note 53370 deleted from function.strtoupper by sobak
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-208428@lists.php.net to get a copy of this message
Note Submitter: Justin_Lin at mail2000 dot com dot tw ---- The following is my code for translate a given string to upper case and it will support chinese traditional : // 2005/5/30 Justin // Chinese_Traditional toupper function CT_to_upper($string) { $isChineseStart = false; $new_string = ""; $i = 0; while($i < strlen($string)) { if (ord(substr($string,$i,1)) <128) { if( $isChineseStart == false ) $new_string .= strtoupper(mb_substr($string,$i,1)); else $new_string .= substr($string,$i,1); } else { if( $isChineseStart == false ) $isChineseStart = true; else $isChineseStart = false; $new_string .= substr($string,$i,1); } $i++; } return $new_string; } //

« previous php.notes (#208428) next »