PHP single character case conversion class

WBOY
Release: 2016-07-25 09:06:32
Original
953 people have browsed it
基本操作
  1. /*
  2. *
  3. * @class Base_Char
  4. * @author zhangys
  5. * @date 2012/06/25
  6. */
  7. class Base_Var_Char
  8. {
  9. public static function isUpper ( $char )
  10. {
  11. $ascii = ord ( $char );
  12. if( $ascii > 64 and $ascii < 91 ) return true;
  13. return false;
  14. }
  15. public static function isLower ( $char )
  16. {
  17. $ascii = ord ( $char );
  18. if( $ascii > 96 and $ascii < 123 ) return true;
  19. return false;
  20. }
  21. public static function toUpper ( $char )
  22. {
  23. if ( self::isUpper ( $char ) ) return $char;
  24. $ascii = ord ( $char );
  25. return chr ( $ascii - 32 );
  26. }
  27. public static function toLower ( $char )
  28. {
  29. if ( self::isLower ( $char ) ) return $char;
  30. $ascii = ord ( $char );
  31. return chr ( $ascii + 32 );
  32. }
  33. }
复制代码


source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template