Class JString

Description

String handling class for utf-8 data Wraps the phputf8 library All functions assume the validity of utf-8 strings. If in doubt use TODO

Located in /i18n/string.php (line 29)


	
			
Method Summary
 string ltrim (string $str, [string $charlist = FALSE])
 string rtrim (string $str, [string $charlist = FALSE])
 int strcasecmp (string $str1, string $str2)
 int strcspn (string $str, string $mask, [int $start = NULL], [int $length = NULL])
 string stristr (string $str, string $search)
 int strlen (string $str)
 mixed strpos ($str $str, $search $search, [$offset $offset = FALSE])
 string strrev (string $str)
 mixed strrpos ($str $str, $search $search)
 void strspn (string $str, string $mask, [int $start = NULL], [int $length = NULL])
 mixed strtolower (string $str)
 mixed strtoupper (string $str)
 void str_ireplace (string $search, string $replace, string $str, [int $count = NULL])
 array str_split (string $str, [int $split_len = 1])
 mixed substr (string $str, integer $offset, [integer $length = FALSE])
 void substr_replace (string $str, string $repl, int $start, [int $length = NULL])
 string transcode (string $source, string $from_encoding, string $to_encoding)
 string trim (string $str, [string $charlist = FALSE])
 string ucfirst (string $str)
 string ucwords (string $str)
Methods
ltrim (line 301)

UTF-8 aware replacement for ltrim()

Strip whitespace (or other characters) from the beginning of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise ltrim will work normally on a UTF-8 string

string ltrim (string $str, [string $charlist = FALSE])
  • string $str: the string to be trimmed
  • string $charlist: the optional charlist of additional characters to trim
rtrim (line 324)

UTF-8 aware replacement for rtrim()

Strip whitespace (or other characters) from the end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise rtrim will work normally on a UTF-8 string

string rtrim (string $str, [string $charlist = FALSE])
  • string $str: the string to be trimmed
  • string $charlist: the optional charlist of additional characters to trim
strcasecmp (line 181)

UTF-8 aware alternative to strcasecmp A case insensivite string comparison

  • return: < 0 if str1 is less than str2; > 0 if str1 is greater than str2, and 0 if they are equal.
  • see: http://www.php.net/strcasecmp
  • access: public
  • static:
int strcasecmp (string $str1, string $str2)
  • string $str1: string 1 to compare
  • string $str2: string 2 to compare
strcspn (line 199)

UTF-8 aware alternative to strcspn Find length of initial segment not matching mask

  • return: the length of the initial segment of str1 which does not contain any of the characters in str2
  • see: http://www.php.net/strcspn
  • access: public
  • static:
int strcspn (string $str, string $mask, [int $start = NULL], [int $length = NULL])
  • string $str
  • string $mask: the mask
  • int $start: Optional starting character position (in characters)
  • int $length: Optional length
stristr (line 223)

UTF-8 aware alternative to stristr Returns all of haystack from the first occurrence of needle to the end.

needle and haystack are examined in a case-insensitive manner Find first occurrence of a string using case insensitive comparison

string stristr (string $str, string $search)
  • string $str: the haystack
  • string $search: the needle
strlen (line 129)

UTF-8 aware alternative to strlen Returns the number of characters in the string (NOT THE NUMBER OF BYTES),

int strlen (string $str)
  • string $str: UTF-8 string
strpos (line 43)

UTF-8 aware alternative to strpos Find position of first occurrence of a string

  • return: Number of characters before the first match or FALSE on failure
  • see: http://www.php.net/strpos
  • access: public
  • static:
mixed strpos ($str $str, $search $search, [$offset $offset = FALSE])
  • $str $str: - string String being examined
  • $search $search: - string String being searced for
  • $offset $offset: - int Optional, specifies the position from which the search should be performed
strrev (line 238)

UTF-8 aware alternative to strrev Reverse a string

string strrev (string $str)
  • string $str: String to be reversed
strrpos (line 62)

UTF-8 aware alternative to strrpos Finds position of last occurrence of a string

mixed strrpos ($str $str, $search $search)
  • $str $str: - string String being examined
  • $search $search: - string String being searced for
strspn (line 255)

UTF-8 aware alternative to strspn Find length of initial segment matching mask

void strspn (string $str, string $mask, [int $start = NULL], [int $length = NULL])
  • string $str: the haystack
  • string $mask: the mask
  • int $start: start optional
  • int $length: length optional
strtolower (line 99)

UTF-8 aware alternative to strtlower

Make a string lowercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings

mixed strtolower (string $str)
  • string $str
strtoupper (line 116)

UTF-8 aware alternative to strtoupper

Make a string uppercase Note: The concept of a characters "case" only exists is some alphabets such as Latin, Greek, Cyrillic, Armenian and archaic Georgian - it does not exist in the Chinese alphabet, for example. See Unicode Standard Annex #21: Case Mappings

mixed strtoupper (string $str)
  • string $str
str_ireplace (line 145)

UTF-8 aware alternative to str_ireplace Case-insensitive version of str_replace

void str_ireplace (string $search, string $replace, string $str, [int $count = NULL])
  • string $search: string to search
  • string $replace: existing string to replace
  • string $str: new string to replace with
  • int $count: optional count value to be passed by referene
str_split (line 165)

UTF-8 aware alternative to str_split Convert a string to an array

array str_split (string $str, [int $split_len = 1])
  • string $str: UTF-8 encoded
  • int $split_len: number to characters to split string by
substr (line 78)

UTF-8 aware alternative to substr Return part of a string given character offset (and optionally length)

mixed substr (string $str, integer $offset, [integer $length = FALSE])
  • string $str
  • integer $offset: number of UTF-8 characters offset (from left)
  • integer $length: (optional) length in UTF-8 characters from offset
substr_replace (line 278)

UTF-8 aware substr_replace Replace text within a portion of a string

void substr_replace (string $str, string $repl, int $start, [int $length = NULL])
  • string $str: the haystack
  • string $repl: the replacement string
  • int $start: start
  • int $length: length (optional)
transcode (line 396)

Transcode a string.

  • return: Transcoded string
  • since: 1.1
  • static:
string transcode (string $source, string $from_encoding, string $to_encoding)
  • string $source: The string to transcode.
  • string $from_encoding: The source encoding.
  • string $to_encoding: The target encoding.
trim (line 347)

UTF-8 aware replacement for trim()

Strip whitespace (or other characters) from the beginning and end of a string Note: you only need to use this if you are supplying the charlist optional arg and it contains UTF-8 characters. Otherwise trim will work normally on a UTF-8 string

string trim (string $str, [string $charlist = FALSE])
  • string $str: the string to be trimmed
  • string $charlist: the optional charlist of additional characters to trim
ucfirst (line 366)

UTF-8 aware alternative to ucfirst Make a string's first character uppercase

string ucfirst (string $str)
  • string $str
ucwords (line 381)

UTF-8 aware alternative to ucwords Uppercase the first character of each word in a string

string ucwords (string $str)
  • string $str

Documentation generated on Sat, 4 Feb 2006 14:26:53 +0100 by phpDocumentor 1.3.0RC4