I18N_UnicodeString
[ class tree: I18N_UnicodeString ] [ index: I18N_UnicodeString ] [ all elements ]

Class: I18N_UnicodeString

Source Location: /I18N_UnicodeString-0.3.1/I18N/UnicodeString.php

Class Overview


Class provides a way to use and manipulate multibyte strings in PHP


Author(s):

Version:

  • Release: @package_version@

Methods


Inherited Variables

Inherited Methods


Class Details

[line 57]
Class provides a way to use and manipulate multibyte strings in PHP


[ Top ]


Method Detail

__construct (Constructor)   [line 104]

I18N_UnicodeString __construct( [mixed $value = ''], [string $encoding = 'UTF-8'])

The constructor of the class string which can receive a new string in a number of formats.

Parameters:

mixed   $value   —  A variable containing the Unicode string in one of various encodings.
string   $encoding   —  The encoding that the string is in.

[ Top ]

append   [line 598]

I18N_UnicodeString append( $unicode, I18N_UnicodeString &$unicode)

Appends a given Unicode string to the end of the current one.
  • Return: The new string created from the appension.
  • Access: public

Parameters:

I18N_UnicodeString   &$unicode   —  The string to append.
   $unicode   — 

[ Top ]

convertArray   [line 82]

array convertArray( array $array, [string $encoding = 'HTML'])

Converts an entire array of strings to Unicode capable strings.

Useful for converting a GET/POST of all its Unicode values into a workable and easily changed format. Takes an optional second parameter similer to that of setString().


Parameters:

array   $array   —  An array of PHP variables.
string   $encoding   —  The encoding the string values are in.

[ Top ]

equals   [line 580]

boolean equals( $unicode, I18N_UnicodeString &$unicode)

Determines if two Unicode strings are equal
  • Return: True if they are equal, false otherwise.
  • Access: public

Parameters:

I18N_UnicodeString   &$unicode   —  The string to compare to.
   $unicode   — 

[ Top ]

indexOf   [line 525]

integer indexOf( mixed $char)

Returns the position of a character much like PHP's strpos function.
  • Return: The location of the character in the string.
  • Access: public

Parameters:

mixed   $char   —  A Unicode char represented as either an integer or a UTF-8 char.

[ Top ]

lastIndexOf   [line 553]

integer lastIndexOf( mixed $char)

Returns the last position of a character much like PHP's strrpos function.
  • Return: The last location of the character in the string.
  • Access: public

Parameters:

mixed   $char   —  A Unicode char represented as either an integer or a UTF-8 char.

[ Top ]

length   [line 372]

integer length( )

Retrieve the length of the string in characters.
  • Return: The length of the string.
  • Access: public

[ Top ]

raiseError   [line 616]

void raiseError( string $message)

Used to raise a PEAR_Error.

Hopefully this method is never called, but when it is it will include the PEAR class and return a new PEAR_Error.

  • Throws: I18N_UnicodeString_Exception
  • Access: public

Parameters:

string   $message   —  The error message to raise.

[ Top ]

setString   [line 129]

mixed setString( mixed $value, [string $encoding = 'UTF-8'])

Set the string to a value passed in one of many encodings.

You may pass the encoding as an optional second parameter which defaults to UTF-8 encoding. Possible encodings are:

  • ASCII - when you pass a normal 7 bit ASCII string
  • UTF-8 - when you pass a UTF-8 encoded string
  • HTML - when you pass a string encoded with HTML entities, such as the kind received from a GET/POST
  • Unicode or UCS-4 - when passing an array of integer values representing each character

  • Return: Returns true on success or PEAR_Error otherwise.
  • Access: public

Parameters:

mixed   $value   —  A variable containing the Unicode string in one of various encodings.
string   $encoding   —  The encoding that the string is in.

[ Top ]

stringReplace   [line 458]

I18N_UnicodeString stringReplace( $find, $replace, I18N_UnicodeString &$find, I18N_UnicodeString &$replace)

Works like PHP's str_replace function.

Parameters:

I18N_UnicodeString   &$find   —  The string to replaced
I18N_UnicodeString   &$replace   —  The string to replace $find with
   $find   — 
   $replace   — 

[ Top ]

strStr   [line 484]

I18N_UnicodeString strStr( $find, I18N_UnicodeString &$find)

Works like PHP's strstr function by returning the string from $find on.
  • Return: The current string from $find on to the end
  • Access: public

Parameters:

I18N_UnicodeString   &$find   —  The string to found
   $find   — 

[ Top ]

subString   [line 390]

I18N_UnicodeString subString( integer $begin, [integer $length = null])

Works exactly like PHP's substr function only it works on Unicode strings.
  • Return: A new I18N_UnicodeString class containing the substring or a PEAR_Error if an error is thrown.
  • Access: public

Parameters:

integer   $begin   —  The beginning of the substring.
integer   $length   —  The length to read. Defaults to the rest of the string.

[ Top ]

subStringReplace   [line 427]

I18N_UnicodeString subStringReplace( $find, $replace, integer $start, [integer $length = null], I18N_UnicodeString &$find, I18N_UnicodeString &$replace)

Works like PHP's substr_replace function.

Parameters:

I18N_UnicodeString   &$find   —  The string to replaced
I18N_UnicodeString   &$replace   —  The string to replace $find with
integer   $start   —  The position in the string to start replacing at
integer   $length   —  The length from the starting to position to stop replacing at
   $find   — 
   $replace   — 

[ Top ]

toHtmlEntitiesString   [line 351]

string toHtmlEntitiesString( )

Retrieves the string and returns it as a string encoded with HTML entities.
  • Return: A string with the Unicode values encoded as HTML entities.
  • Access: public

[ Top ]

toUtf8String   [line 333]

string toUtf8String( )

Retrieves the string and returns it as a UTF-8 encoded string.
  • Return: A string with the Unicode values encoded in UTF-8.
  • Access: public

[ Top ]

unicodeCharToUtf8   [line 286]

string unicodeCharToUtf8( integer $char)

Transforms a single unicode character represented by an integer to a UTF-8 string.

Suggested by Lukas Feiler (#7429)

  • Return: The unicode character converted to a UTF-8 string.
  • Access: public

Parameters:

integer   $char   —  A unicode character as an integer

[ Top ]

utf8ToUnicode   [line 216]

array utf8ToUnicode( [string $string = ''])

Converts a UTF-8 string into our representation of an array of integers.

Method was made static by suggestion of Lukas Feiler (#7429)

  • Return: The array of Unicode values.
  • Access: public

Parameters:

string   $string   —  A string containing Unicode values encoded in UTF-8

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:55 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.