ucfirst.php 425 B

12345678910111213141516171819
  1. <?php
  2. /**
  3. * UTF8::ucfirst
  4. *
  5. * @package KO7
  6. *
  7. * @copyright (c) 2007-2016 Kohana Team
  8. * @copyright (c) since 2016 Koseven Team
  9. * @copyright (c) 2005 Harry Fuecks
  10. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt
  11. */
  12. function _ucfirst($str)
  13. {
  14. if (UTF8::is_ascii($str))
  15. return ucfirst($str);
  16. preg_match('/^(.?)(.*)$/us', $str, $matches);
  17. return UTF8::strtoupper($matches[1]).$matches[2];
  18. }