.

StringPHP Class Reference

String class using php functions. 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 php functions.

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


Member Function Documentation

StringPHP::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
Attention:
This will work with MBString onyl!

Definition at line 15 of file string.php.cls.php.

00015                                                                   {
00016                 return true; 
00017         }
StringPHP::convert ( value,
from = false,
to = false  
)

Convert input to current charset.

Parameters:
string  $value Input to convert
Returns:
string

Definition at line 25 of file string.php.cls.php.

00025                                                                     {
00026                 if (empty($to)) { $to = GyroLocale::get_charset(); }
00027                 
00028                 $ret = $value;
00029                 if (!empty($from) && function_exists('iconv')) {
00030                         $ret = iconv($from, $to . '//IGNORE', $value);
00031                 }
00032                 return $ret;
00033         }       
StringPHP::length ( val  ) 

Character set aware strlen().

Definition at line 60 of file string.php.cls.php.

00060                                      {
00061                 return strlen($val);
00062         }
StringPHP::stripos ( haystack,
needle,
offset = NULL  
)

Definition at line 68 of file string.php.cls.php.

00068                                                                     {
00069                 return stripos($haystack, $needle, $offset);
00070         }
StringPHP::strpos ( haystack,
needle,
offset = NULL  
)

Definition at line 64 of file string.php.cls.php.

00064                                                                    {
00065                 return strpos($haystack, $needle, $offset);
00066         }
StringPHP::strrpos ( haystack,
needle  
)

Definition at line 72 of file string.php.cls.php.

00072                                                     {
00073                 if ($haystack == '') {
00074                         return false;
00075                 }
00076                 return strrpos($haystack, $needle);
00077         }
StringPHP::substr ( val,
start = 0,
length = NULL  
)

Character set aware substr.

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

00082                                                                  {
00083                 if ($length === NULL) {
00084                         $length = $this->length($val);
00085                 }
00086                 return substr($val, $start, $length);
00087         }
StringPHP::to_lower ( val  ) 

Character set aware strtolower().

Parameters:
String  Value to convert into lowercase
Returns:
String converted string

Definition at line 42 of file string.php.cls.php.

00042                                        {
00043                 return strtolower($val);
00044         }       
StringPHP::to_upper ( val  ) 

Character set aware strtoupper().

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

Definition at line 53 of file string.php.cls.php.

00053                                        {
00054                 return strtoupper($val);
00055         }

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