\CryptoManana\Core\Interfaces\DesignPatternsCoreStringBuilderInterface

Interface CoreStringBuilderInterface - Static methods for core string manipulations.

Summary

Methods
Constants
isUsingMbString()
useMbString()
stringLength()
stringToUpper()
stringToLower()
getChr()
getOrd()
stringReverse()
stringSplit()
stringReplace()
stringFullTrimming()
No constants found
No protected methods found
N/A
No private methods found
N/A

Methods

isUsingMbString()

isUsingMbString() : boolean

Check if the `mbstring` extension usage is enabled or not.

Returns

boolean —

Is the component using mbstring.

useMbString()

useMbString(boolean|integer  $bool = true) 

Enable or disable the `mbstring` extension usage.

Parameters

boolean|integer $bool

Flag for enabling or disabling the mbstring usage.

stringLength()

stringLength(string|mixed  $string) : integer|false

Get the string's length.

Parameters

string|mixed $string

The string for length measuring.

Returns

integer|false —

The string length or false on invalid parameter given.

stringToUpper()

stringToUpper(string|mixed  $string) : string|false

Make a string uppercase.

Parameters

string|mixed $string

The string for uppercase conversion.

Returns

string|false —

The string converted to uppercase or false on invalid parameter given.

stringToLower()

stringToLower(string|mixed  $string) : string|false

Make a string lowercase.

Parameters

string|mixed $string

The string for lowercase conversion.

Returns

string|false —

The string converted to lowercase or false on invalid parameter given.

getChr()

getChr(integer  $byteValue) : string|false

Get a character by its encoding integer code value.

Parameters

integer $byteValue

The integer code numerical value for character conversion.

Returns

string|false —

The wanted character string or false on invalid parameter given.

getOrd()

getOrd(string|mixed  $string) : integer|false

Get a character's encoding integer code by its string representation.

Parameters

string|mixed $string

The character string value for integer code conversion.

Returns

integer|false —

The wanted character code or false on invalid parameter given.

stringReverse()

stringReverse(string|mixed  $string) : string|false

Reverse a string.

Parameters

string|mixed $string

The string for reversing.

Returns

string|false —

The reversed string or false on invalid parameter given.

stringSplit()

stringSplit(string|mixed  $string, integer  $chunkLength = 1) : array|false

Convert a string to an array.

Parameters

string|mixed $string

The string for conversion to array.

integer $chunkLength

The chunk length for string splitting.

Returns

array|false —

The string converted to an array or false on invalid parameter given.

stringReplace()

stringReplace(string|array|mixed  $search, string|array|mixed  $replace, string|array  $subject, null|integer  $count = null) : string|array

Replace all occurrences of the search string with the replacement string. It also supports arrays.

Parameters

string|array|mixed $search

The string for searching or an array with multiple values.

string|array|mixed $replace

The replacement string or an array with multiple values.

string|array $subject

The string or array being searched and replaced on.

null|integer $count

This will hold the number of matched and replaced values.

Returns

string|array —

Returns a string or an array with the replaced values.

stringFullTrimming()

stringFullTrimming(string|mixed  $string) : string|false

Fully strip whitespace from every position of a string.

Parameters

string|mixed $string

The string for full trimming.

Returns

string|false —

The fully trimmed string or false on invalid parameter given.