$str is cast to a string prior to assignment, and if
$encoding is not specified, it defaults to mb_internal_encoding().
final public __construct(string $str = '',
?string $encoding = null)Returns the string value of the object
public __toString():string
Performs a regular expression match
public match(string $pattern):bool
Returns a string with whitespace removed from the start and end of the string
public trim(?string $charMask = null):MbStringReturns a string with whitespace removed from the start of the string
public trimLeft(?string $charMask = null):MbStringReturns a string with whitespace removed from the end of the string
public trimRight(?string $charMask = null):MbStringChecks whether the haystack string contains all $needles
public containsAll(string ... $needles):bool
Checks whether the string contains any of the needles
public containsAny(string ... $needles):bool
Checks whether the string starts with the given needles
public startsWith(string $needle):bool
Checks whether the string ends with the given needles
public endsWith(string $needle):bool
Returns the number of occurrences of $substring in the string
public countSubstr(string $substring,
bool $caseSensitive = true):int
public is(string|int $type):bool
Checks whether the string is empty
public isEmpty():bool
Returns the length of the string
public count():int
Perform a regular expression search and replace
public pregReplace(string $pattern,
string $replacement,
int $limit = -1,
?int $count = null):MbStringReplaces a regular expression with multibyte support
public eregReplace(string $pattern,
string $replacement,
?string $option = null):MbStringReplaces all occurrences of $search in $str by $replacement
public replace(array|string $search,
array|string $replacement):MbStringReturns the index of the first occurrence of $needle in the string
public strpos(string $needle,
int $offset = 0):?int
Returns the character at $index, with indexes starting at 0
public charAt(int $index):?string
Returns an array consisting of the characters in the string
public toArray():array
Rewinds the Iterator to the first element
public rewind():void
Returns the current character
public current():?string
Return the key of the current character
public key():int
Checks if current iterator position is valid
public valid():bool
Creates a string object from given str and encoding properties
public static create(Stringable|string|int|float|null $str = null,
?string $encoding = null):MbString