IntlChar::totitle
(PHP 7)
IntlChar::totitle — Make Unicode character titlecase
説明
The given character is mapped to its titlecase equivalent. If the character has no titlecase equivalent, the original character itself is returned.
パラメータ
codepoint
- コードポイントを表す int 型の値 (例: U+2603 SNOWMAN を表す
0x2603
)、あるいは UTF-8 文字列としてエンコードされた文字 (例:"\u{2603}"
)。
返り値
Returns the Simple_Titlecase_Mapping of the code point, if any; otherwise the code point itself.
戻り値の型は int になります。ただし、コードポイントを UTF-8 文字列で渡した場合は別で、その場合の返り値の型は文字列になります。
例
例1 さまざまなコードポイントの例
<?phpvar_dump(IntlChar::totitle("A"));var_dump(IntlChar::totitle("a"));var_dump(IntlChar::totitle("Φ"));var_dump(IntlChar::totitle("φ"));var_dump(IntlChar::totitle("1"));var_dump(IntlChar::totitle(ord("A")));var_dump(IntlChar::totitle(ord("a")));?>
上の例の出力は以下となります。
string(1) "A" string(1) "A" string(2) "Φ" string(2) "Φ" string(1) "1" int(65) int(65)
参考
- IntlChar::tolower() - Make Unicode character lowercase
- IntlChar::toupper() - Make Unicode character uppercase
- mb_convert_case() - 文字列に対してケースフォールディングを行う