UtfSafeString
Table of Contents
Methods
- checkEncoding() : bool
- Checks array of strings or string for invalid unicode symbols.
- escapeInvalidUtf() : string
- Escapes 4-bytes UTF sequences.
- getLastPosition() : mixed
- pad() : string
- Pads utf string as str_pad.
- rtrimInvalidUtf() : mixed
Methods
checkEncoding()
Checks array of strings or string for invalid unicode symbols.
public
static checkEncoding(array<string|int, mixed>|string $data) : bool
If input data does not contain invalid characters, returns TRUE; otherwise, returns FALSE.
Parameters
- $data : array<string|int, mixed>|string
-
Input data to validate.
Return values
boolescapeInvalidUtf()
Escapes 4-bytes UTF sequences.
public
static escapeInvalidUtf(mixed $string) : string
Parameters
- $string : mixed
Return values
stringgetLastPosition()
public
static getLastPosition(mixed $haystack, mixed $needle) : mixed
Parameters
- $haystack : mixed
- $needle : mixed
pad()
Pads utf string as str_pad.
public
static pad(mixed $string, mixed $padLen[, mixed $padStr = ' ' ][, int $padType = STR_PAD_RIGHT ]) : string
Using parameters like native str_pad().
Parameters
- $string : mixed
- $padLen : mixed
- $padStr : mixed = ' '
- $padType : int = STR_PAD_RIGHT
Return values
stringrtrimInvalidUtf()
public
static rtrimInvalidUtf(mixed $string) : mixed
Parameters
- $string : mixed