Constants

PREG_PATTERN_ORDER

PREG_PATTERN_ORDER = \PREG_PATTERN_ORDER

PREG_SET_ORDER

PREG_SET_ORDER = \PREG_SET_ORDER

PREG_OFFSET_CAPTURE

PREG_OFFSET_CAPTURE = \PREG_OFFSET_CAPTURE

PREG_UNMATCHED_AS_NULL

PREG_UNMATCHED_AS_NULL = \PREG_UNMATCHED_AS_NULL

PREG_SPLIT

PREG_SPLIT = 0

PREG_SPLIT_NO_EMPTY

PREG_SPLIT_NO_EMPTY = \PREG_SPLIT_NO_EMPTY

PREG_SPLIT_DELIM_CAPTURE

PREG_SPLIT_DELIM_CAPTURE = \PREG_SPLIT_DELIM_CAPTURE

PREG_SPLIT_OFFSET_CAPTURE

PREG_SPLIT_OFFSET_CAPTURE = \PREG_SPLIT_OFFSET_CAPTURE

ALPHABET_ALPHANUMERIC

ALPHABET_ALPHANUMERIC = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

Properties

$string

$string

$ignoreCase

$ignoreCase

Methods

__construct()

__construct(string  $string = '') : mixed

Parameters

string $string

Returns

mixed —

unwrap()

unwrap(array  $values) : string[]|array

Unwraps instances of AbstractString back to strings.

Parameters

array $values

Returns

string[]|array —

wrap()

wrap(array  $values) : static[]|array

Wraps (and normalizes) strings in instances of AbstractString.

Parameters

array $values

Returns

static[]|array —

after()

after(string|string[]  $needle, bool  $includeNeedle = false, int  $offset) : static

Parameters

string|string[] $needle
bool $includeNeedle
int $offset

Returns

static —

afterLast()

afterLast(string|string[]  $needle, bool  $includeNeedle = false, int  $offset) : static

Parameters

string|string[] $needle
bool $includeNeedle
int $offset

Returns

static —

append()

append(string  ...$suffix) : static

Parameters

string $suffix variadic

Returns

static —

before()

before(string|string[]  $needle, bool  $includeNeedle = false, int  $offset) : static

Parameters

string|string[] $needle
bool $includeNeedle
int $offset

Returns

static —

beforeLast()

beforeLast(string|string[]  $needle, bool  $includeNeedle = false, int  $offset) : static

Parameters

string|string[] $needle
bool $includeNeedle
int $offset

Returns

static —

bytesAt()

bytesAt(int  $offset) : int[]

Parameters

int $offset

Returns

int[] —

camel()

camel() : static

Returns

static —

chunk()

chunk(int  $length = 1) : static[]

Parameters

int $length

Returns

static[] —

collapseWhitespace()

collapseWhitespace() : static

Returns

static —

containsAny()

containsAny(string|string[]  $needle) : bool

Parameters

string|string[] $needle

Returns

bool —

endsWith()

endsWith(mixed  $suffix) : bool

Parameters

mixed $suffix

Returns

bool —

ensureEnd()

ensureEnd(string  $suffix) : static

Parameters

string $suffix

Returns

static —

ensureStart()

ensureStart(string  $prefix) : static

Parameters

string $prefix

Returns

static —

equalsTo()

equalsTo(mixed  $string) : bool

Parameters

mixed $string

Returns

bool —

folded()

folded() : static

Returns

static —

ignoreCase()

ignoreCase() : static

Returns

static —

indexOf()

indexOf(mixed  $needle, int  $offset) : ?int

Parameters

mixed $needle
int $offset

Returns

?int —

indexOfLast()

indexOfLast(mixed  $needle, int  $offset) : ?int

Parameters

mixed $needle
int $offset

Returns

?int —

isEmpty()

isEmpty() : bool

Returns

bool —

join()

join(array  $strings, string  $lastGlue = null) : static

Parameters

array $strings
string $lastGlue

Returns

static —

jsonSerialize()

jsonSerialize() : string

Returns

string —

length()

length() : int

Returns

int —

lower()

lower() : static

Returns

static —

match()

match(string  $regexp, int  $flags, int  $offset) : array

Matches the string using a regular expression.

Pass PREG_PATTERN_ORDER or PREG_SET_ORDER as $flags to get all occurrences matching the regular expression.

Parameters

string $regexp
int $flags
int $offset

Returns

array —

All matches in a multi-dimensional array ordered according to flags

padBoth()

padBoth(int  $length, string  $padStr = ' ') : static

Parameters

int $length
string $padStr

Returns

static —

padEnd()

padEnd(int  $length, string  $padStr = ' ') : static

Parameters

int $length
string $padStr

Returns

static —

padStart()

padStart(int  $length, string  $padStr = ' ') : static

Parameters

int $length
string $padStr

Returns

static —

prepend()

prepend(string  ...$prefix) : static

Parameters

string $prefix variadic

Returns

static —

repeat()

repeat(int  $multiplier) : static

Parameters

int $multiplier

Returns

static —

replace()

replace(string  $from, string  $to) : static

Parameters

string $from
string $to

Returns

static —

replaceMatches()

replaceMatches(string  $fromRegexp, mixed  $to) : static

Parameters

string $fromRegexp
mixed $to

Returns

static —

reverse()

reverse() : static

Returns

static —

slice()

slice(int  $start, int  $length = null) : static

Parameters

int $start
int $length

Returns

static —

snake()

snake() : static

Returns

static —

splice()

splice(string  $replacement, int  $start, int  $length = null) : static

Parameters

string $replacement
int $start
int $length

Returns

static —

split()

split(string  $delimiter, int  $limit = null, int  $flags = null) : static[]

Parameters

string $delimiter
int $limit
int $flags

Returns

static[] —

startsWith()

startsWith(mixed  $prefix) : bool

Parameters

mixed $prefix

Returns

bool —

title()

title(bool  $allWords = false) : static

Parameters

bool $allWords

Returns

static —

toByteString()

toByteString(string  $toEncoding = null) : \Symfony\Component\String\ByteString

Parameters

string $toEncoding

Returns

\Symfony\Component\String\ByteString —

toCodePointString()

toCodePointString(string  $fromEncoding = null) : \Symfony\Component\String\CodePointString

Parameters

string $fromEncoding

Returns

\Symfony\Component\String\CodePointString —

toString()

toString() : string

Returns

string —

toUnicodeString()

toUnicodeString(string  $fromEncoding = null) : \Symfony\Component\String\UnicodeString

Parameters

string $fromEncoding

Returns

\Symfony\Component\String\UnicodeString —

trim()

trim(string  $chars = " 	

") : static

Parameters

string $chars

Returns

static —

trimEnd()

trimEnd(string  $chars = " 	

") : static

Parameters

string $chars

Returns

static —

trimStart()

trimStart(string  $chars = " 	

") : static

Parameters

string $chars

Returns

static —

truncate()

truncate(int  $length, string  $ellipsis = '', bool  $cut = true) : static

Parameters

int $length
string $ellipsis
bool $cut

Returns

static —

upper()

upper() : static

Returns

static —

width()

width(bool  $ignoreAnsiDecoration = true) : int

Returns the printable length on a terminal.

Parameters

bool $ignoreAnsiDecoration

Returns

int —

wordwrap()

wordwrap(int  $width = 75, string  $break = "
", bool  $cut = false) : static

Parameters

int $width
string $break
bool $cut

Returns

static —

__sleep()

__sleep() : array

Returns

array —

__clone()

__clone() : mixed

Returns

mixed —

__toString()

__toString() : string

Returns

string —

fromRandom()

fromRandom(int  $length = 16, string  $alphabet = null) : self

Parameters

int $length
string $alphabet

Returns

self —

isUtf8()

isUtf8() : bool

Returns

bool —