Native
extends AbstractStringWrapper
in package
Table of Contents
- $convertEncoding : string|null
- An optionally character encoding to convert to
- $encoding : string
- The character encoding working on (overwritten to change default encoding)
- convert() : string|false
- Convert a string from defined character encoding to the defined convert encoding
- getConvertEncoding() : string|null
- Get the defined character encoding to convert to
- getEncoding() : string
- Get the defined character encoding to work with
- getSupportedEncodings() : array<string|int, string>
- Get a list of supported character encodings
- isSupported() : bool
- Check if the given character encoding is supported by this wrapper and the character encoding to convert to is also supported.
- setEncoding() : StringWrapperInterface
- Set character encoding working with and convert to
- strlen() : int|false
- Returns the length of the given string
- strPad() : string
- Pad a string to a certain length with another string
- strpos() : int|false
- Find the position of the first occurrence of a substring in a string
- substr() : string|false
- Returns the portion of string specified by the start and length parameters
- wordWrap() : string|false
- Wraps a string to a given number of characters
Properties
$convertEncoding
An optionally character encoding to convert to
protected
string|null
$convertEncoding
$encoding
The character encoding working on (overwritten to change default encoding)
protected
string
$encoding
= 'ASCII'
Methods
convert()
Convert a string from defined character encoding to the defined convert encoding
public
convert(string $str[, bool $reverse = false ]) : string|false
Parameters
- $str : string
- $reverse : bool = false
Return values
string|false —getConvertEncoding()
Get the defined character encoding to convert to
public
getConvertEncoding() : string|null
Return values
string|null —getEncoding()
Get the defined character encoding to work with
public
getEncoding() : string
Tags
Return values
string —getSupportedEncodings()
Get a list of supported character encodings
public
static getSupportedEncodings() : array<string|int, string>
Return values
array<string|int, string> —isSupported()
Check if the given character encoding is supported by this wrapper and the character encoding to convert to is also supported.
public
static isSupported(string $encoding[, string|null $convertEncoding = null ]) : bool
Parameters
- $encoding : string
- $convertEncoding : string|null = null
Return values
bool —setEncoding()
Set character encoding working with and convert to
public
setEncoding(string $encoding[, string|null $convertEncoding = null ]) : StringWrapperInterface
Parameters
- $encoding : string
-
The character encoding to work with
- $convertEncoding : string|null = null
-
The character encoding to convert to
Return values
StringWrapperInterface —strlen()
Returns the length of the given string
public
strlen(string $str) : int|false
Parameters
- $str : string
Return values
int|false —strPad()
Pad a string to a certain length with another string
public
strPad(string $input, int $padLength[, string $padString = ' ' ][, int $padType = STR_PAD_RIGHT ]) : string
Parameters
- $input : string
- $padLength : int
- $padString : string = ' '
- $padType : int = STR_PAD_RIGHT
Return values
string —strpos()
Find the position of the first occurrence of a substring in a string
public
strpos(string $haystack, string $needle, int $offset) : int|false
Parameters
- $haystack : string
- $needle : string
- $offset : int
Return values
int|false —substr()
Returns the portion of string specified by the start and length parameters
public
substr(string $str, int $offset[, int|null $length = null ]) : string|false
Parameters
- $str : string
- $offset : int
- $length : int|null = null
Return values
string|false —wordWrap()
Wraps a string to a given number of characters
public
wordWrap(string $string[, int $width = 75 ][, string $break = "
" ][, bool $cut = false ]) : string|false
Parameters
- $string : string
- $width : int = 75
- $break : string = " "
- $cut : bool = false