Copied!

Represents a string of Unicode grapheme clusters encoded as UTF-8.

A letter followed by combining characters (accents typically) form what Unicode defines as a grapheme cluster: a character as humans mean it in written texts. This class knows about the concept and won't split a letter apart from its combining accents. It also ensures all string comparisons happen on their canonically-composed representation, ignoring e.g. the order in which accents are listed when a letter has many of them.

CloneableInstantiable
Constants
public Symfony\Component\String\AbstractUnicodeString::NFC = 16
public Symfony\Component\String\AbstractUnicodeString::NFD = 4
public Symfony\Component\String\AbstractUnicodeString::NFKC = 32
public Symfony\Component\String\AbstractUnicodeString::NFKD = 8
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 __construct(string $string = '')
public Symfony\Component\String\AbstractString::__sleep() : array
public Symfony\Component\String\AbstractString::__toString() : string
public __wakeup() : void
public Symfony\Component\String\AbstractString::after(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public Symfony\Component\String\AbstractString::afterLast(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public append(string $suffix) : static
public Symfony\Component\String\AbstractUnicodeString::ascii(array $rules = []) : self
 

Generic UTF-8 to ASCII transliteration.

Install the intl extension for best results.

  • param string[]|\Transliterator[]|\Closure[] $rules See "*-Latin" rules from Transliterator::listIDs()
public Symfony\Component\String\AbstractString::before(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public Symfony\Component\String\AbstractString::beforeLast(Traversable|array|string $needle, bool $includeNeedle = false, int $offset = 0) : static
 
  • param string|string[] $needle
public Symfony\Component\String\AbstractString::bytesAt(int $offset) : array
 
  • return int[]
public Symfony\Component\String\AbstractUnicodeString::camel() : static
public chunk(int $length = 1) : array
public Symfony\Component\String\AbstractUnicodeString::codePointsAt(int $offset) : array
 
  • return int[]
public Symfony\Component\String\AbstractString::collapseWhitespace() : static
public Symfony\Component\String\AbstractString::containsAny(Traversable|array|string $needle) : bool
 
  • param string|string[] $needle
public endsWith(Traversable|Symfony\Component\String\AbstractString|array|string $suffix) : bool
public Symfony\Component\String\AbstractString::ensureEnd(string $suffix) : static
public Symfony\Component\String\AbstractString::ensureStart(string $prefix) : static
public equalsTo(Traversable|Symfony\Component\String\AbstractString|array|string $string) : bool
public Symfony\Component\String\AbstractUnicodeString::folded(bool $compat = true) : static
public static Symfony\Component\String\AbstractUnicodeString::fromCodePoints(int $codes) : static
public Symfony\Component\String\AbstractString::ignoreCase() : static
public indexOf(Traversable|Symfony\Component\String\AbstractString|array|string $needle, int $offset = 0) : ?int
public indexOfLast(Traversable|Symfony\Component\String\AbstractString|array|string $needle, int $offset = 0) : ?int
public Symfony\Component\String\AbstractString::isEmpty() : bool
public join(array $strings, ?string $lastGlue = NULL) : static
public Symfony\Component\String\AbstractString::jsonSerialize() : string
public length() : int
public Symfony\Component\String\AbstractUnicodeString::lower() : static
public Symfony\Component\String\AbstractUnicodeString::match(string $regexp, int $flags = 0, int $offset = 0) : array
public normalize(int $form = 16self::NFC) : static
public Symfony\Component\String\AbstractUnicodeString::padBoth(int $length, string $padStr = ' ') : static
public Symfony\Component\String\AbstractUnicodeString::padEnd(int $length, string $padStr = ' ') : static
public Symfony\Component\String\AbstractUnicodeString::padStart(int $length, string $padStr = ' ') : static
public prepend(string $prefix) : static
public Symfony\Component\String\AbstractString::repeat(int $multiplier) : static
public replace(string $from, string $to) : static
public replaceMatches(string $fromRegexp, callable|string $to) : static
public Symfony\Component\String\AbstractUnicodeString::reverse() : static
public slice(int $start = 0, ?int $length = NULL) : static
public Symfony\Component\String\AbstractUnicodeString::snake() : static
public splice(string $replacement, int $start = 0, ?int $length = NULL) : static
public split(string $delimiter, ?int $limit = NULL, ?int $flags = NULL) : array
public startsWith(Traversable|Symfony\Component\String\AbstractString|array|string $prefix) : bool
public Symfony\Component\String\AbstractUnicodeString::title(bool $allWords = false) : static
public Symfony\Component\String\AbstractString::toByteString(?string $toEncoding = NULL) : Symfony\Component\String\ByteString
public Symfony\Component\String\AbstractString::toCodePointString() : Symfony\Component\String\CodePointString
public Symfony\Component\String\AbstractString::toString() : string
public Symfony\Component\String\AbstractString::toUnicodeString() : Symfony\Component\String\UnicodeString
public Symfony\Component\String\AbstractUnicodeString::trim(string $chars = '  ') : static
public Symfony\Component\String\AbstractUnicodeString::trimEnd(string $chars = '  ') : static
public Symfony\Component\String\AbstractUnicodeString::trimPrefix( $prefix) : static
public Symfony\Component\String\AbstractUnicodeString::trimStart(string $chars = '  ') : static
public Symfony\Component\String\AbstractUnicodeString::trimSuffix( $suffix) : static
public Symfony\Component\String\AbstractString::truncate(int $length, string $ellipsis = '', bool $cut = true) : static
public static Symfony\Component\String\AbstractString::unwrap(array $values) : array
 

Unwraps instances of AbstractString back to strings.

  • return string[]|array
public Symfony\Component\String\AbstractUnicodeString::upper() : static
public Symfony\Component\String\AbstractUnicodeString::width(bool $ignoreAnsiDecoration = true) : int
public Symfony\Component\String\AbstractString::wordwrap(int $width = 75, string $break = ' ', bool $cut = false) : static
public static Symfony\Component\String\AbstractString::wrap(array $values) : array
 

Wraps (and normalizes) strings in instances of AbstractString.

  • return static[]|array
Properties
protected ?bool Symfony\Component\String\AbstractString::$ignoreCase = false
protected string Symfony\Component\String\AbstractString::$string = ''
Methods
public static Symfony\Component\String\AbstractUnicodeString::fromCodePoints(int $codes) : static
public static Symfony\Component\String\AbstractString::unwrap(array $values) : array
 

Unwraps instances of AbstractString back to strings.

  • return string[]|array
public static Symfony\Component\String\AbstractString::wrap(array $values) : array
 

Wraps (and normalizes) strings in instances of AbstractString.

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