ucfirst.php 398 B

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