source: branches/rsr.v5.1.1/web/punbb/include/utf8/ucfirst.php @ 6

Last change on this file since 6 was 3, checked in by dj3c1t, 13 years ago

passage a Fluxbb 1.4.7

File size: 697 bytes
Line 
1<?php
2
3/**
4* @version $Id: ucfirst.php,v 1.1 2006/02/25 13:50:17 harryf Exp $
5* @package utf8
6* @subpackage strings
7*/
8
9/**
10* UTF-8 aware alternative to ucfirst
11* Make a string's first character uppercase
12* Note: requires utf8_strtoupper
13* @param string
14* @return string with first character as upper case (if applicable)
15* @see http://www.php.net/ucfirst
16* @see utf8_strtoupper
17* @package utf8
18* @subpackage strings
19*/
20function utf8_ucfirst($str)
21{
22        switch (utf8_strlen($str))
23        {
24                case 0:
25                        return '';
26                        break;
27                case 1:
28                        return utf8_strtoupper($str);
29                        break;
30                default:
31                        preg_match('/^(.{1})(.*)$/us', $str, $matches);
32                        return utf8_strtoupper($matches[1]).$matches[2];
33                        break;
34        }
35}
Note: See TracBrowser for help on using the repository browser.