PHP Класс SqlParser\UtfString

In this library, this class should be used to parse UTF-8 queries.
Наследование: implements ArrayAccess
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$byteIdx integer For ASCII strings, the byte index is equal to the character index.
$byteLen integer The length of the string (in bytes).
$charIdx integer For non-ASCII strings, some characters occupy more than one byte and the character index will have a lower value than the byte index.
$charLen integer The length of the string (in characters).
$str string The raw, multi-byte string.

Открытые методы

Метод Описание
__construct ( string $str ) Constructor.
__toString ( ) : string Returns the contained string.
getCharLength ( string $byte ) : integer Gets the length of an UTF-8 character.
length ( ) : integer Returns the length in characters of the string.
offsetExists ( integer $offset ) : boolean Checks if the given offset exists.
offsetGet ( integer $offset ) : string Gets the character at given offset.
offsetSet ( integer $offset, string $value ) : void Sets the value of a character.
offsetUnset ( integer $offset ) : void Unsets an index.

Описание методов

__construct() публичный Метод

Constructor.
public __construct ( string $str )
$str string The string.

__toString() публичный Метод

Returns the contained string.
public __toString ( ) : string
Результат string

getCharLength() публичный статический Метод

According to RFC 3629, a UTF-8 character can have at most 4 bytes. However, this implementation supports UTF-8 characters containing up to 6 bytes.
См. также: https://tools.ietf.org/html/rfc3629
public static getCharLength ( string $byte ) : integer
$byte string The byte to be analyzed.
Результат integer

length() публичный Метод

Returns the length in characters of the string.
public length ( ) : integer
Результат integer

offsetExists() публичный Метод

Checks if the given offset exists.
public offsetExists ( integer $offset ) : boolean
$offset integer The offset to be checked.
Результат boolean

offsetGet() публичный Метод

Gets the character at given offset.
public offsetGet ( integer $offset ) : string
$offset integer The offset to be returned.
Результат string

offsetSet() публичный Метод

Sets the value of a character.
public offsetSet ( integer $offset, string $value ) : void
$offset integer The offset to be set.
$value string The value to be set.
Результат void

offsetUnset() публичный Метод

Unsets an index.
public offsetUnset ( integer $offset ) : void
$offset integer The value to be unset.
Результат void

Описание свойств

$byteIdx публичное свойство

For ASCII strings, the byte index is equal to the character index.
public int $byteIdx
Результат integer

$byteLen публичное свойство

The length of the string (in bytes).
public int $byteLen
Результат integer

$charIdx публичное свойство

For non-ASCII strings, some characters occupy more than one byte and the character index will have a lower value than the byte index.
public int $charIdx
Результат integer

$charLen публичное свойство

The length of the string (in characters).
public int $charLen
Результат integer

$str публичное свойство

The raw, multi-byte string.
public string $str
Результат string