Copied!

Represents a string of abstract characters.

Unicode defines 3 types of "characters" (bytes, code points and grapheme clusters). This class is the abstract type to use as a type-hint when the logic you want to implement doesn't care about the exact variant it deals with.

Abstract
Constants
public Symfony\Component\String\AbstractString::PREG_OFFSET_CAPTURE = 256
public Symfony\Component\String\AbstractString::PREG_PATTERN_ORDER = 1
public Symfony\Component\String\AbstractString::PREG_SET_ORDER = 2
public Symfony\Component\String\AbstractString::PREG_SPLIT = 0
public Symfony\Component\String\AbstractString::PREG_SPLIT_DELIM_CAPTURE = 2
public Symfony\Component\String\AbstractString::PREG_SPLIT_NO_EMPTY = 1
public Symfony\Component\String\AbstractString::PREG_SPLIT_OFFSET_CAPTURE = 4
public Symfony\Component\String\AbstractString::PREG_UNMATCHED_AS_NULL = 512
Methods
public __clone()
public abstract __construct(string $string = '')
public __sleep() : array
public __toString() : string
public after(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public afterLast(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public abstract append(string $suffix) : static
public before(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public beforeLast(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public bytesAt(int $offset) : array
 
  • return int[]
public abstract camel() : static
public abstract chunk(int $length = 1) : array
 
  • return static[]
public collapseWhitespace() : static
public containsAny(Traversable|array|string $needle) : bool
 
  • param string|string[] $needle
public endsWith(Traversable|array|string $suffix) : bool
 
  • param string|string[] $suffix
public ensureEnd(string $suffix) : static
public ensureStart(string $prefix) : static
public equalsTo(Traversable|array|string $string) : bool
 
  • param string|string[] $string
public abstract folded() : static
public ignoreCase() : static
public indexOf(Traversable|array|string $needle, int $offset = 0) : ?int
 
  • param string|string[] $needle
public indexOfLast(Traversable|array|string $needle, int $offset = 0) : ?int
 
  • param string|string[] $needle
public isEmpty() : bool
public abstract join(array $strings, ?string $lastGlue = NULL) : static
public jsonSerialize() : string
public abstract length() : int
public abstract lower() : static
public abstract match(string $regexp, int $flags = 0, int $offset = 0) : 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.

  • return array All matches in a multi-dimensional array ordered according to flags
public abstract padBoth(int $length, string $padStr = ' ') : static
public abstract padEnd(int $length, string $padStr = ' ') : static
public abstract padStart(int $length, string $padStr = ' ') : static
public abstract prepend(string $prefix) : static
public repeat(int $multiplier) : static
public abstract replace(string $from, string $to) : static
public abstract replaceMatches(string $fromRegexp, callable|string $to) : static
public abstract reverse() : static
public abstract slice(int $start = 0, ?int $length = NULL) : static
public abstract snake() : static
public abstract splice(string $replacement, int $start = 0, ?int $length = NULL) : static
public split(string $delimiter, ?int $limit = NULL, ?int $flags = NULL) : array
 
  • return static[]
public startsWith(Traversable|array|string $prefix) : bool
 
  • param string|string[] $prefix
public abstract title(bool $allWords = false) : static
public toByteString(?string $toEncoding = NULL) : Symfony\Component\String\ByteString
public toCodePointString() : Symfony\Component\String\CodePointString
public toString() : string
public toUnicodeString() : Symfony\Component\String\UnicodeString
public abstract trim(string $chars = '  ') : static
public abstract trimEnd(string $chars = '  ') : static
public trimPrefix( $prefix) : static
 
  • param string|string[] $prefix
public abstract trimStart(string $chars = '  ') : static
public trimSuffix( $suffix) : static
 
  • param string|string[] $suffix
public truncate(int $length, string $ellipsis = '', bool $cut = true) : static
public static unwrap(array $values) : array
 

Unwraps instances of AbstractString back to strings.

  • return string[]|array
public abstract upper() : static
public abstract width(bool $ignoreAnsiDecoration = true) : int
 

Returns the printable length on a terminal.

public wordwrap(int $width = 75, string $break = ' ', bool $cut = false) : static
public static wrap(array $values) : array
 

Wraps (and normalizes) strings in instances of AbstractString.

  • return static[]|array
Properties
protected ?bool $ignoreCase = false
protected string $string = ''
Methods
public static unwrap(array $values) : array
 

Unwraps instances of AbstractString back to strings.

  • return string[]|array
public static wrap(array $values) : array
 

Wraps (and normalizes) strings in instances of AbstractString.

  • return static[]|array
© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration