\CryptoManana\CoreStringBuilder

Class StringBuilder - The core component for string manipulations and encoding support.

Summary

Methods
Properties
Constants
getInstance()
__toString()
isUsingMbString()
stringLength()
stringToUpper()
stringToLower()
getChr()
getOrd()
stringReverse()
stringSplit()
stringReplace()
stringFullTrimming()
No public properties found
No constants found
__construct()
multiByteStringReplace()
$usingMbString
N/A
__wakeup()
__sleep()
__clone()
No private properties found
N/A

Properties

$usingMbString

$usingMbString : boolean

Internal flag to enable or disable the `mbstring` extension usage.

Type

boolean — Enable or disable unicode `mbstring` functions.

Methods

__toString()

__toString() : string

Return the name of the current defined class that extends the class.

Returns

string —

Name of the class.

isUsingMbString()

isUsingMbString() : boolean

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

Returns

boolean —

Is the component using mbstring.

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.

__construct()

__construct() 

Locks the creation of new objects but allows static creation and extending.

multiByteStringReplace()

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

Replace all occurrences of the search string with the replacement string.

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 $subject

The string being searched and replaced on.

null|integer $count

This will hold the number of matched and replaced values.

Returns

string|array —

Returns a string with the replaced values.

__wakeup()

__wakeup() 

Lock the reinitialization and unserialization abilities of the class.

__sleep()

__sleep() 

Lock the serialization abilities of the class.

__clone()

__clone() 

Lock the ability to clone properties and create a new dynamic instance of the class.