.

StringMBString Class Reference

String class using mbstring stuff. More...

List of all members.

Public Member Functions

  check_encoding ($value, $encoding=false)
  Check if given string matches current encoding.
  convert ($value, $from=false, $to=false)
  Convert input to current charset.
  length ($val)
  Character set aware strlen().
  stripos ($haystack, $needle, $offset=NULL)
  strpos ($haystack, $needle, $offset=NULL)
  strrpos ($haystack, $needle)
  substr ($val, $start=0, $length=NULL)
  Character set aware substr.
  to_lower ($val)
  Character set aware strtolower().
  to_upper ($val)
  Character set aware strtoupper().

Detailed Description

String class using mbstring stuff.

Definition at line 5 of file string.mbstring.cls.php.


Member Function Documentation

StringMBString::check_encoding ( value,
encoding = false  
)

Check if given string matches current encoding.

Parameters:
string  $value Value to check
string  $encoding Encoding to check against. Use FALSE for current encoding
Returns:
bool

Definition at line 13 of file string.mbstring.cls.php.

00013                                                                   {
00014                 if (empty($encoding)) { 
00015                         $encoding = GyroLocale::get_charset(); 
00016                 }
00017                 return mb_check_encoding($value, $encoding);
00018         }
StringMBString::convert ( value,
from = false,
to = false  
)

Convert input to current charset.

Parameters:
string  $value Input to convert
string  $from Encoding to convert from. Use FALSE for auto-detecting encoding of $value
string  $to Encoding to covert to. Use FALSE for current encoding set on GyroLocale
Returns:
string Converted Value

Definition at line 28 of file string.mbstring.cls.php.

00028                                                                     {
00029                 if (empty($to)) { $to = GyroLocale::get_charset(); }
00030                 
00031                 $ret = $value;
00032                 if (empty($from)) {
00033                         // Autodetecting
00034                         if (!$this->check_encoding($value, $to)) {
00035                                 $ret = mb_convert_encoding($value, $to);
00036                         }
00037                 }
00038                 else {
00039                         $ret = mb_convert_encoding($value, $to, $from);
00040                 }
00041                 return $ret;
00042         }       
StringMBString::length ( val  ) 

Character set aware strlen().

Definition at line 70 of file string.mbstring.cls.php.

00070                                      {
00071                 return mb_strlen($val, GyroLocale::get_charset());
00072         }
StringMBString::stripos ( haystack,
needle,
offset = NULL  
)

Definition at line 78 of file string.mbstring.cls.php.

00078                                                                     {
00079                 return mb_stripos($haystack, $needle, $offset, GyroLocale::get_charset());
00080         }
StringMBString::strpos ( haystack,
needle,
offset = NULL  
)

Definition at line 74 of file string.mbstring.cls.php.

00074                                                                    {
00075                 return mb_strpos($haystack, $needle, $offset, GyroLocale::get_charset());
00076         }
StringMBString::strrpos ( haystack,
needle  
)

Definition at line 82 of file string.mbstring.cls.php.

00082                                                     {
00083                 if ($haystack == '') {
00084                         return false;
00085                 }
00086                 return mb_strrpos($haystack, $needle, GyroLocale::get_charset());
00087         }
StringMBString::substr ( val,
start = 0,
length = NULL  
)

Character set aware substr.

Definition at line 92 of file string.mbstring.cls.php.

00092                                                                  {
00093                 if ($length === NULL) {
00094                         $length = $this->length($val);
00095                 }
00096                 return mb_substr($val, $start, $length, GyroLocale::get_charset());
00097         }
StringMBString::to_lower ( val  ) 

Character set aware strtolower().

Parameters:
String  Value to convert into lowercase
Integer  Number of chars to convert, 0 for all.
Returns:
String converted string

Definition at line 52 of file string.mbstring.cls.php.

00052                                        {
00053                 return mb_strtolower($val, GyroLocale::get_charset());
00054         }
StringMBString::to_upper ( val  ) 

Character set aware strtoupper().

Parameters:
String  Value to convert into upper case
Returns:
String converted string

Definition at line 63 of file string.mbstring.cls.php.

00063                                        {
00064                 return mb_strtoupper($val, GyroLocale::get_charset());
00065         }

The documentation for this class was generated from the following file: