AbstractStringWrapper
in package
implements
StringWrapperInterface
Interfaces, Classes, Traits and Enums
Table of Contents
- $convertEncoding : string|null
- An optionally character encoding to convert to
- $encoding : string|null
- The character encoding working on
- 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
- 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
- strPad() : string
- Pad a string to a certain length with another string
- 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
protected
string|null
$encoding
= 'UTF-8'
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 —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 —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 —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