\JString
String handling class for utf-8 data Wraps the phputf8 library All functions assume the validity of utf-8 strings.
Synopsis
class JString
{
- // members
- protected $incrementStyles;
- // methods
- public static array splitCamelCase()
- public static string increment()
- public static mixed strpos()
- public static mixed strrpos()
- public static mixed substr()
- public static mixed strtolower()
- public static mixed strtoupper()
- public static integer strlen()
- public static string str_ireplace()
- public static array str_split()
- public static integer strcasecmp()
- public static integer strcmp()
- public static integer strcspn()
- public static string stristr()
- public static string strrev()
- public static integer strspn()
- public static string substr_replace()
- public static string ltrim()
- public static string rtrim()
- public static string trim()
- public static string ucfirst()
- public static string ucwords()
- public static mixed transcode()
- public static boolean valid()
- public static boolean compliant()
- public static mixed parse_url()
Members
protected
- $incrementStyles
—
array
Increment styles.
Methods
public
- compliant() — Tests whether a string complies as UTF-8. This will be much faster than utf8_is_valid but will pass five and six octet UTF-8 sequences, which are not supported by Unicode and so cannot be displayed correctly in a browser. In other words it is not as strict as utf8_is_valid but it's faster. If you use it to validate user input, you place yourself at the risk that attackers will be able to inject 5 and 6 byte sequences (which may or may not be a significant risk, depending on what you are are doing)
- increment() — Increments a trailing number in a string.
- ltrim() — UTF-8 aware replacement for ltrim()
- parse_url() — Does a UTF-8 safe version of PHP parse_url function
- rtrim() — UTF-8 aware replacement for rtrim() Strip whitespace (or other characters) from the end of a string 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
- splitCamelCase() — Split a string in camel case format
- str_ireplace() — UTF-8 aware alternative to str_ireplace Case-insensitive version of str_replace
- str_split() — UTF-8 aware alternative to str_split Convert a string to an array
- strcasecmp() — UTF-8/LOCALE aware alternative to strcasecmp A case insensitive string comparison
- strcmp() — UTF-8/LOCALE aware alternative to strcmp A case sensitive string comparison
- strcspn() — UTF-8 aware alternative to strcspn Find length of initial segment not matching mask
- stristr() — UTF-8 aware alternative to stristr Returns all of haystack from the first occurrence of needle to the end.
- strlen() — UTF-8 aware alternative to strlen.
- strpos() — UTF-8 aware alternative to strpos.
- strrev() — UTF-8 aware alternative to strrev Reverse a string
- strrpos() — UTF-8 aware alternative to strrpos Finds position of last occurrence of a string
- strspn() — UTF-8 aware alternative to strspn Find length of initial segment matching mask
- strtolower() — UTF-8 aware alternative to strtlower
- strtoupper() — 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
- substr() — UTF-8 aware alternative to substr Return part of a string given character offset (and optionally length)
- substr_replace() — UTF-8 aware substr_replace Replace text within a portion of a string
- transcode() — Transcode a string.
- trim() — 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
- ucfirst() — UTF-8 aware alternative to ucfirst Make a string's first character uppercase or all words' first character uppercase
- ucwords() — UTF-8 aware alternative to ucwords Uppercase the first character of each word in a string
- valid() — Tests a string as to whether it's valid UTF-8 and supported by the Unicode standard.