Sgss_String_Charset_Abstract 
Abstract class for handling characters in strings in the specific character set defined in the iconv library

Description

Implements:
Sgss_String_Charset_Interface
Author:
Matsuda Shota
Copyright:
(c) 2007-2008 Matsuda Shota
License:
http://creativecommons.org/licenses/GPL/2.0/
Located in:
/String/Charset/Abstract.php (line 47)

Direct descendants

Sgss_String_Charset_Ascii Handles characters in strings in the ASCII character set
Sgss_String_Charset_Big5 Handles characters in strings in the BIG5 character set
Sgss_String_Charset_Euckr Handles characters in strings in the EUC-KR character set
Sgss_String_Charset_Gbk Handles characters in strings in the GBK character set
Sgss_String_Charset_Iso88591 Handles characters in strings in the ISO-8859-1 character set
Sgss_String_Charset_Johab Handles characters in strings in the JOHAB character set
Sgss_String_Charset_Macarabic Handles characters in strings in the MacArabic character set
Sgss_String_Charset_Macgreek Handles characters in strings in the MacGreek character set
Sgss_String_Charset_Machebrew Handles characters in strings in the MacHebrew character set
Sgss_String_Charset_Macroman Handles characters in strings in the MacRoman character set
Sgss_String_Charset_Macthai Handles characters in strings in the MacThai character set
Sgss_String_Charset_Shiftjis Handles characters in strings in the ShiftJIS character set
Sgss_String_Charset_Utf16 Handles characters in strings in the UTF-16 character set
Sgss_String_Charset_Utf8 Handles characters in strings in the UTF-8 character set

Class overview

Variable

protected string $_charset

Character set to be used in this converter

Methods

string|null char (string $value, int $index)

Returns the character at the specified index of the specified string

int code (string $value, int $index)

Returns the unicode codepoint of the specified index of this specified string

string|null convert (string $value, string $charset)

Converts the specified string into the specified character set

string getName ()

Return the name of character set used in this converter

int index (string $value, String $str, int $offset, [boolean $reverse = false])

Returns the index at which the specified substring first appears in the specified string

int length (string $value)

Returns the character length of the specified string

string|null substr (string $value, int $offset, int $length)

Retruns the substring of the specified string with the specified offset and length

protected static string _flatten (string $name)

Removes any characters but the alphabet or number from the specified character set name

protected static string _regularize (string $name)

Converts the specified character set notation to the corresponding regular name

Variable detail

$_charset 

Character set to be used in this converter

Overridden by:
Signature:
protected string $_charset = null


Method detail

char

Returns the character at the specified index of the specified string

Parameters:
  • string $value

    String in the character set

  • int $index

    Index of character

Specified by:
Uses:
iconv_substr()
Related subject:
Sgss_String_Charset_Interface::char()
Signature:
public string|null char (string $value, int $index)


code

Returns the unicode codepoint of the specified index of this specified string

Parameters:
  • string $value

    String in the character set

  • int $index

    Index of character

Specified by:
Uses:
iconv()
Related subject:
Sgss_String_Charset_Interface::code()
Signature:
public int code (string $value, int $index)


convert

Converts the specified string into the specified character set

Parameters:
  • string $value

    String in the character set

  • string $charset

    Character set

Specified by:
Uses:
Sgss_String_Charset_Abstract::_flatten(), Sgss_String_Charset_Abstract::_regularize()
Related subject:
Sgss_String_Charset_Interface::convert()
Signature:
public string|null convert (string $value, string $charset)


getName

Return the name of character set used in this converter

Specified by:
Related subject:
Sgss_String_Charset_Interface
Signature:
public string getName ()


index

Returns the index at which the specified substring first appears in the specified string

Parameters:
  • string $value

    Value in the character set

  • String $str

    Substring in the character set

  • int $offset

    Starting offset to search

  • boolean $reverse

    Whether to search from the end of the string

Specified by:
Uses:
iconv_substr(), iconv_strrpos(), iconv_strpos()
Related subject:
Sgss_String_Charset_Interface::index()
Signature:
public int index (string $value, String $str, int $offset, [boolean $reverse = false])


length

Returns the character length of the specified string

Parameters:
  • string $value

    String in the character set

Specified by:
Uses:
iconv_strlen()
Related subject:
Sgss_String_Charset_Interface::length()
Signature:
public int length (string $value)


substr

Retruns the substring of the specified string with the specified offset and length

Parameters:
  • string $value

    String in the specific character set

  • int $offset

    Offset of the substring

  • int $length

    Length of the substring

Specified by:
Uses:
iconv_substr()
Related subject:
Sgss_String_Charset_Interface::substr()
Signature:
public string|null substr (string $value, int $offset, int $length)


_flatten  

Removes any characters but the alphabet or number from the specified character set name

Parameters:
  • string $name

    Character set name

Used by:
Sgss_String_Charset_Abstract::convert()
Signature:
protected static string _flatten (string $name)


_regularize  

Converts the specified character set notation to the corresponding regular name

Parameters:
  • string $name

    Character set notation

Used by:
Sgss_String_Charset_Abstract::convert()
Signature:
protected static string _regularize (string $name)