diff options
-rw-r--r-- | it.class | 2 | ||||
-rwxr-xr-x | tests/it.t | 4 |
2 files changed, 5 insertions, 1 deletions
@@ -432,7 +432,7 @@ static function ucfirst($string) */ static function ucwords($string) { - return preg_replace_callback('/\b\w/u', function($m) { return mb_strtoupper($m[1]); }, mb_strtolower($string)); + return preg_replace_callback('/\b\w/u', function($m) { return mb_strtoupper($m[0]); }, mb_strtolower($string)); } static function substr_replace($string, $replacement, $start, $length) @@ -347,6 +347,10 @@ is(it::date('datetime', 1000000.543), it::date('datetime', "1000000"), '... larg is(it::date('time', "10.5"), "10:05", 'interpret string with points with strtotime'); is(it::date('time', "10.05"), "10:05", 'interpret string with points with strtotime'); +# it::uc* +is(it::ucfirst('foo bär über'), 'Foo bär über'); +is(it::ucwords('foo bär über'), 'Foo Bär Über'); + # it::substr_replace is(it::substr_replace('abcdefgh', 'xyz', 2, 4), substr_replace('abcdefgh', 'xyz', 2, 4), 'it::substr_replace the same as substr_replace for ascii'); is(it::substr_replace('✔☯♥', '☃☃', 1, 1), '✔☃☃♥', 'it::substr_replace for utf-8'); |