- class
str(php\lib\str) - package
std - source
php/lib/Str.php
Description
Class str
str ::pos()- Returns the index within this string of the first occurrence of thestr ::posIgnoreCase()- The same method as pos() only with ignoring case charactersstr ::lastPos()- Returns the index within this string of the last occurrence of thestr ::lastPosIgnoreCase()- The same method aslastPos()only with ignoring case charactersstr ::sub()- Returns a new string that is a substring of this string. Thestr ::compare()- Compares two strings lexicographically.str ::compareIgnoreCase()- The same method ascompare()only with ignoring case charactersstr ::equalsIgnoreCase()- Checks that the strings are equal with ignoring case charactersstr ::startsWith()- Tests if the substring of this string beginning at thestr ::endsWith()- Tests if this string ends with the specified suffix.str ::lower()- Converts all of the characters in$stringto lowerstr ::upper()- Converts all of the characters in$stringto upperstr ::length()- Returns the length of$string.str ::replace()- Replaces each substring of this string that matches the literal targetstr ::repeat()- Return s a new string consisting of the original$stringrepeatedstr ::trim()- Returns a copy of the string, with leading and trailing whitespacestr ::trimRight()str ::trimLeft()str ::reverse()- Reverse the string.str ::shuffle()- Returns a randomized string based on chars in $stringstr ::random()- Returns a new random string based on set.str ::split()- The method like explode() in Zend PHP.str ::join()- The method likeimplode()in Zend PHP.str ::encode()- Converts $string by using $charset and returns a binary string.str ::decode()- Decodes $string by using $charset to UNICODE, returns a unicode string.str ::isNumber()- Returns true if $string is integer number (e.g: '12893', '3784', '0047')str ::isLower()str ::isUpper()str ::lowerFirst()str ::upperFirst()str ::parseAs()- Parse text as json, ini, yaml, etc.str ::formatAs()- Format value as ini, json, yml, etc.str ::format()str ::contains()- Returns true if string contains a substring.str ::count()- Возвращает количество найденный строк в другой строке.str ::uuid()str ::hash()- Возвращает хеш строки.str ::lines()- Переводит многострочный текст в массив, если $removeEmpty true, то удаляет пустые строки из результата.
str::pos(string $string, string $search, int $fromIndex): intReturns the index within this string of the first occurrence of the specified substring, starting at the specified index.
str::posIgnoreCase(string $string, string $search, int $fromIndex): intThe same method as pos() only with ignoring case characters
str::lastPos(string $string, string $search, null|int $fromIndex): intReturns the index within this string of the last occurrence of the specified substring. The last occurrence of the empty string "" is considered to occur at the index value $string.length.
str::lastPosIgnoreCase(string $string, string $search, null|int $fromIndex): intThe same method as lastPos() only with ignoring case characters
str::sub(string $string, int $beginIndex, null|int $endIndex): stringReturns a new string that is a substring of this string. The
substring begins at the specified $beginIndex and
extends to the character at index $endIndex - 1.
Thus the length of the substring is endIndex - beginIndex.
str::compare(string $string1, string $string2): intCompares two strings lexicographically. The comparison is based on the Unicode value of each character in the strings.
The character sequence represented by $string1
String is compared lexicographically to the
character sequence represented by $string2. The result is
a negative integer if $string1
lexicographically precedes $string2. The result is a
positive integer if $string1 lexicographically
follows $string2. The result is zero if the strings
are equal; compare returns 0 exactly when
the strings are equal
str::compareIgnoreCase(string $string1, string $string2): intThe same method as compare() only with ignoring case characters
str::equalsIgnoreCase(string $string1, string $string2): boolChecks that the strings are equal with ignoring case characters
str::startsWith(string $string, string $prefix, int $offset): boolTests if the substring of this string beginning at the specified index starts with the specified prefix.
Returns true if the character sequence represented by the
argument is a prefix of the substring of this object starting
at index offset; false otherwise.
The result is false if toffset is
negative or greater than the length of this
$string; otherwise the result is the same
as the result of the expression
.. code-block:: php
startsWith(sub($offset), $prefix)
str::endsWith(string $string, string $suffix): boolTests if this string ends with the specified suffix.
str::lower(string $string): stringConverts all of the characters in $string to lower
case using the rules of the default locale.
str::upper(string $string): stringConverts all of the characters in $string to upper
case using the rules of the default locale.
str::length(string $string): intReturns the length of $string.
The length is equal to the number of Unicode code units in the string.
str::replace(string $string, string $target, string $replacement): stringReplaces each substring of this string that matches the literal target sequence with the specified literal replacement sequence. The replacement proceeds from the beginning of the string to the end, for example, replacing "aa" with "b" in the string "aaa" will result in "ba" rather than "ab".
str::repeat(string $string, int $amount): stringReturn s a new string consisting of the original $string repeated
str::trim(string $string, string $charList): stringReturns a copy of the string, with leading and trailing whitespace omitted.
str::trimRight(string $string, string $charList): stringstr::trimLeft(string $string, string $charList): stringstr::reverse(string $string): stringReverse the string.
str::shuffle(string $string): stringReturns a randomized string based on chars in $string
str::random(int $length, string $set): stringReturns a new random string based on set.
str::split(string $string, string $separator, int $limit): arrayThe method like explode() in Zend PHP.
str::join(array|\Iterator $iterable, string $separator, int $limit): stringThe method like implode() in Zend PHP.
str::encode(string $string, string $charset): stringConverts $string by using $charset and returns a binary string.
str::decode(string $string, string $charset): stringDecodes $string by using $charset to UNICODE, returns a unicode string.
str::isNumber(string $string, bool $bigNumbers): boolReturns true if $string is integer number (e.g: '12893', '3784', '0047')
- for
123- true - for
00304- true - for
3389e4- false - for
3.49- false - for
23- false
str::isLower(string $string): boolstr::isUpper(mixed $string): boolstr::lowerFirst(string $string): stringstr::upperFirst(string $string): stringstr::parseAs(string $string, string $format, int $flags): mixedParse text as json, ini, yaml, etc.
str::formatAs(mixed $input, string $format, int $flags): stringFormat value as ini, json, yml, etc.
str::format(string $string, mixed $args): stringstr::contains(string $string, string $search): boolReturns true if string contains a substring.
str::count(string $string, string $subString, int $offset): intВозвращает количество найденный строк в другой строке.
str::uuid(null|string $value): stringstr::hash(string $string, string $algorithm): stringВозвращает хеш строки.
str::lines(string $string, bool $removeEmpty): arrayПереводит многострочный текст в массив, если $removeEmpty true, то удаляет пустые строки из результата.
__construct(): void