[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/joomla/string/src/phputf8/ -> ucfirst.php (source)

   1  <?php
   2  /**
   3  * @package utf8
   4  */
   5  
   6  //---------------------------------------------------------------
   7  /**
   8  * UTF-8 aware alternative to ucfirst
   9  * Make a string's first character uppercase
  10  * Note: requires utf8_strtoupper
  11  * @param string
  12  * @return string with first character as upper case (if applicable)
  13  * @see http://www.php.net/ucfirst
  14  * @see utf8_strtoupper
  15  * @package utf8
  16  */
  17  function utf8_ucfirst($str){
  18      switch ( utf8_strlen($str) ) {
  19          case 0:
  20              return '';
  21          break;
  22          case 1:
  23              return utf8_strtoupper($str);
  24          break;
  25          default:
  26              preg_match('/^(.{1})(.*)$/us', $str, $matches);
  27              return utf8_strtoupper($matches[1]).$matches[2];
  28          break;
  29      }
  30  }
  31  


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer