Convert extends Encoding
in package
Com\Tecnick\Unicode\Convert
Tags
Table of Contents
Methods
- chr() : string
- Returns the unicode string containing the character specified by value
- chrArrToOrdArr() : array<string|int, int>
- Converts an array of UTF-8 chars to an array of codepoints (integer values)
- getSubUniArrStr() : string
- Extract a slice of the $uniarr array and return it as string
- hexToStr() : string
- Convert an hexadecimal string (byte string - as in the PDF standard) to string
- latinArrToStr() : string
- Converts an array of Latin1 code points to a string
- ord() : int
- Returns the unicode value of the specified character
- ordArrToChrArr() : array<string|int, string>
- Converts an array of UTF-8 code points array of chars
- strToChrArr() : array<int, string>
- Converts an UTF-8 string to an array of UTF-8 codepoints (integer values)
- strToHex() : string
- Convert a string to an hexadecimal string (byte string) representation (as in the PDF standard)
- strToOrdArr() : array<string|int, int>
- Converts an UTF-8 string to an array of UTF-8 codepoints (integer values)
- toUTF16BE() : string
- Converts an UTF-8 string to UTF-16BE
- toUTF8() : string
- Converts a string with an unknown encoding to UTF-8
- uniArrToLatinArr() : array<string|int, int>
- Converts UTF-8 code array to Latin1 codes
Methods
chr()
Returns the unicode string containing the character specified by value
public chr(int $ord)
: string
Parameters
- $ord : int
-
Unicode character value to convert
Return values
string —Returns the unicode string
chrArrToOrdArr()
Converts an array of UTF-8 chars to an array of codepoints (integer values)
public chrArrToOrdArr(array<string|int,
string> $chars)
: array<string|int,
int>
Parameters
- $chars : array<string|int, string>
-
Array of UTF-8 chars
Return values
array<string|int, int>getSubUniArrStr()
Extract a slice of the $uniarr array and return it as string
public getSubUniArrStr(array<string|int,
string> $uniarr[,
int $start
= 0
][,
int|null $end
= null
]) : string
Parameters
- $uniarr : array<string|int, string>
-
The input array of characters
- $start : int = 0
-
The position of the starting element
- $end : int|null = null
-
The position of the first element that will not be returned.
Return values
stringhexToStr()
Convert an hexadecimal string (byte string - as in the PDF standard) to string
public hexToStr(string $hex)
: string
Parameters
- $hex : string
-
Hex code to convert
Return values
stringlatinArrToStr()
Converts an array of Latin1 code points to a string
public latinArrToStr(array<string|int,
int> $latarr)
: string
Parameters
- $latarr : array<string|int, int>
-
Array of Latin1 code points
Return values
stringord()
Returns the unicode value of the specified character
public ord(string $chr)
: int
Parameters
- $chr : string
-
Unicode character
Return values
int —Returns the unicode value
ordArrToChrArr()
Converts an array of UTF-8 code points array of chars
public ordArrToChrArr(array<string|int,
int> $ords)
: array<string|int,
string>
Parameters
- $ords : array<string|int, int>
-
Array of UTF-8 code points
Return values
array<string|int, string>strToChrArr()
Converts an UTF-8 string to an array of UTF-8 codepoints (integer values)
public strToChrArr(string $str)
: array<int,
string>
Parameters
- $str : string
-
String to convert
Return values
array<int, string>strToHex()
Convert a string to an hexadecimal string (byte string) representation (as in the PDF standard)
public strToHex(string $str)
: string
Parameters
- $str : string
-
String to convert
Return values
stringstrToOrdArr()
Converts an UTF-8 string to an array of UTF-8 codepoints (integer values)
public strToOrdArr(string $str)
: array<string|int,
int>
Parameters
- $str : string
-
Convert to convert
Return values
array<string|int, int>toUTF16BE()
Converts an UTF-8 string to UTF-16BE
public toUTF16BE(string $str)
: string
Parameters
- $str : string
-
UTF-8 String to convert
Return values
string —UTF-16BE encoded string
toUTF8()
Converts a string with an unknown encoding to UTF-8
public toUTF8(string $str[,
null|string|array<string|int,
string> $enc
= null
]) : string
Parameters
- $str : string
-
String to convert
- $enc : null|string|array<string|int, string> = null
-
Array or comma separated list string of encodings
Return values
string —UTF-8 encoded string
uniArrToLatinArr()
Converts UTF-8 code array to Latin1 codes
public uniArrToLatinArr(array<string|int,
int> $ordarr)
: array<string|int,
int>
Parameters
- $ordarr : array<string|int, int>
-
Array containing UTF-8 code points
Return values
array<string|int, int> —Array containing Latin1 code points