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

Class: I18N_UnicodeString

Source Location: /I18N_UnicodeString-0.2.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 51]
Class provides a way to use and manipulate multibyte strings in PHP
  • Author: John Downey <jdowney@gmail.com>
  • Version: Release: @package_version@
  • Access: public


[ Top ]


Method Detail

I18N_UnicodeString (Constructor)   [line 95]

I18N_UnicodeString I18N_UnicodeString( [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 558]

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 75]

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 542]

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 491]

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 517]

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 352]

integer length( )

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

[ Top ]

raiseError   [line 573]

PEAR_Error 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.

  • Return: A PEAR error message.
  • Access: public

Parameters:

string   $message   —  The error message to raise.

[ Top ]

setString   [line 118]

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 431]

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 452]

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 368]

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 403]

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 332]

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 315]

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 269]

string unicodeCharToUtf8( $char, integer $int)

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   $int   —  A unicode character as an integer
   $char   — 

[ Top ]

utf8ToUnicode   [line 201]

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 14:39:30 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.