関数 SubTitle($String,$Length) {
if (mb_strwidth($String, 'UTF8')
$String を返します;
}その他{
$I = 0;
$len_word = 0;
while ($len_word
$StringTMP = substr($String,$I,1);
if ( ord($StringTMP) >=224 ){
$StringTMP = substr($String,$I,3);
$I = $I + 3;
$len_word = $len_word + 2;
}elseif( ord($StringTMP) >=192 ){
$StringTMP = substr($String,$I,2);
$I = $I + 2;
$len_word = $len_word + 2;
}その他{
$I = $I + 1;
$len_word = $len_word + 1;
}
$StringLast[] = $StringTMP;
}
/* raywang が dirk 用に編集します (es/index.php)*/
if (is_array($StringLast) && !empty($StringLast)){
$StringLast = implode("",$StringLast);
$StringLast .= "...";
}
$StringLast を返します;
}
}