PHP Класс Spatie\String\Str

См. также: Underscore\Methods\StringsMethods
Наследование: implements ArrayAcces\ArrayAccess
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
$string string

Открытые методы

Метод Описание
__call ( $method, $args ) : mixed | Str Unknown methods calls will be handled by various integrations.
__construct ( string $string = '' )
__toString ( ) : string
between ( $start, $end ) : Str Get the string between the given start and end.
concat ( $string ) : Str Concatenate a string.
contains ( array | string $needle, boolean $caseSensitive = false, boolean $absolute = false ) : boolean Alias for find.
firstSegment ( string $delimiter ) : Str Get the first segment from a string based on a delimiter.
lastSegment ( string $delimiter ) : Str Get the last segment from a string based on a delimiter.
offsetExists ( mixed $offset ) : boolean Whether a offset exists.
offsetGet ( mixed $offset ) : mixed Offset to retrieve.
offsetSet ( mixed $offset, mixed $value ) Offset to set.
offsetUnset ( mixed $offset ) Offset to unset.
pop ( string $delimiter ) : Str Pop (remove) the last segment of a string based on a delimiter.
possessive ( ) : Str Get the possessive version of a string.
prefix ( $string ) : Str Prefix a string.
replaceFirst ( $search, $replace ) : Str Replace the first occurrence of a string.
replaceLast ( $search, $replace ) : Str Replace the last occurrence of a string.
segment ( string $delimiter, integer $index ) : Str Get a segment from a string based on a delimiter.
suffix ( $string ) : Str Suffix a string.
tease ( integer $length = 200, string $moreTextIndicator = '...' ) : Str Shortens a string in a pretty way. It will clean it by trimming it, remove all double spaces and html. If the string is then still longer than the specified $length it will be shortened. The end of the string is always a full word concatinated with the specified moreTextIndicator.
toLower ( ) : Str Convert the string to lowercase.
toUpper ( ) : Str Convert the string to uppercase.
trim ( string $characterMask = " " ) : Str Strip whitespace (or other characters) from the beginning and end of a string.

Приватные методы

Метод Описание
sanitizeForTease ( $string ) : string Sanitize the string for teasing.

Описание методов

__call() публичный Метод

Unknown methods calls will be handled by various integrations.
public __call ( $method, $args ) : mixed | Str
$method
$args
Результат mixed | Str

__construct() публичный Метод

public __construct ( string $string = '' )
$string string

__toString() публичный Метод

public __toString ( ) : string
Результат string

between() публичный Метод

Get the string between the given start and end.
public between ( $start, $end ) : Str
$start
$end
Результат Str

concat() публичный Метод

Concatenate a string.
public concat ( $string ) : Str
$string
Результат Str

contains() публичный Метод

Alias for find.
public contains ( array | string $needle, boolean $caseSensitive = false, boolean $absolute = false ) : boolean
$needle array | string
$caseSensitive boolean
$absolute boolean
Результат boolean

firstSegment() публичный Метод

Get the first segment from a string based on a delimiter.
public firstSegment ( string $delimiter ) : Str
$delimiter string
Результат Str

lastSegment() публичный Метод

Get the last segment from a string based on a delimiter.
public lastSegment ( string $delimiter ) : Str
$delimiter string
Результат Str

offsetExists() публичный Метод

Whether a offset exists.
public offsetExists ( mixed $offset ) : boolean
$offset mixed An offset to check for.
Результат boolean true on success or false on failure. The return value will be casted to boolean if non-boolean was returned.

offsetGet() публичный Метод

Offset to retrieve.
public offsetGet ( mixed $offset ) : mixed
$offset mixed The offset to retrieve.
Результат mixed Can return all value types.

offsetSet() публичный Метод

Offset to set.
public offsetSet ( mixed $offset, mixed $value )
$offset mixed The offset to assign the value to.
$value mixed The value to set.

offsetUnset() публичный Метод

Offset to unset.
public offsetUnset ( mixed $offset )
$offset mixed The offset to unset.

pop() публичный Метод

Pop (remove) the last segment of a string based on a delimiter.
public pop ( string $delimiter ) : Str
$delimiter string
Результат Str

possessive() публичный Метод

Get the possessive version of a string.
public possessive ( ) : Str
Результат Str

prefix() публичный Метод

Prefix a string.
public prefix ( $string ) : Str
$string
Результат Str

replaceFirst() публичный Метод

Replace the first occurrence of a string.
public replaceFirst ( $search, $replace ) : Str
$search
$replace
Результат Str

replaceLast() публичный Метод

Replace the last occurrence of a string.
public replaceLast ( $search, $replace ) : Str
$search
$replace
Результат Str

segment() публичный Метод

Returns an empty string when the offset doesn't exist. Use a negative index to start counting from the last element.
public segment ( string $delimiter, integer $index ) : Str
$delimiter string
$index integer
Результат Str

suffix() публичный Метод

Suffix a string.
public suffix ( $string ) : Str
$string
Результат Str

tease() публичный Метод

Shortens a string in a pretty way. It will clean it by trimming it, remove all double spaces and html. If the string is then still longer than the specified $length it will be shortened. The end of the string is always a full word concatinated with the specified moreTextIndicator.
public tease ( integer $length = 200, string $moreTextIndicator = '...' ) : Str
$length integer
$moreTextIndicator string
Результат Str

toLower() публичный Метод

Convert the string to lowercase.
public toLower ( ) : Str
Результат Str

toUpper() публичный Метод

Convert the string to uppercase.
public toUpper ( ) : Str
Результат Str

trim() публичный Метод

Strip whitespace (or other characters) from the beginning and end of a string.
public trim ( string $characterMask = " " ) : Str
$characterMask string
Результат Str

Описание свойств

$string защищенное свойство

protected string $string
Результат string