The Yii framework is free software. It is released under the terms of the following BSD License.
Copyright © 2008-2018 by Yii Software LLC, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Methods | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
public
static
|
byteLength(string $string): int
Returns the number of bytes in the given string.
This method ensures the string is treated as a byte array by using `mb…
Returns the number of bytes in the given string.
This method ensures the string is treated as a byte array by using Parameters
Returnsthe number of bytes in the given string. |
# | ||||||||||
public
static
|
byteSubstr(string $string, int $start, int $length = null): string
Returns the portion of string specified by the start and length parameters.
This method ensures the string is treated…
Returns the portion of string specified by the start and length parameters.
This method ensures the string is treated as a byte array by using Parameters
Returnsthe extracted part of string, or FALSE on failure or an empty string. |
# | ||||||||||
public
static
|
basename(string $path, string $suffix = ''): string
Returns the trailing name component of a path.
This method is similar to the php function `basename()` except that it…
Returns the trailing name component of a path.
This method is similar to the php function Parameters
Returnsthe trailing name component of the given path. |
# | ||||||||||
public
static
|
dirname(string $path): string
Returns parent directory's path.
This method is similar to `dirname()` except that it will treat
both \ and / as…
Returns parent directory's path.
This method is similar to Parameters
Returnsthe parent directory's path. |
# | ||||||||||
public
static
|
truncate(string $string, int $length, string $suffix = '...', string $encoding = null, bool $asHtml = false): string
Truncates a string to the number of characters specified.
Truncates a string to the number of characters specified. Parameters
Returnsthe truncated string. |
# | ||||||||||
public
static
|
truncateWords(string $string, int $count, string $suffix = '...', bool $asHtml = false): string
Truncates a string to the number of words specified.
Truncates a string to the number of words specified. Parameters
Returnsthe truncated string. |
# | ||||||||||
protected
static
|
truncateHtml(string $string, int $count, string $suffix, string|bool $encoding = false): string
Truncate a string while preserving the HTML.
Truncate a string while preserving the HTML. Parameters
|
# | ||||||||||
public
static
|
startsWith(string $string, string $with, bool $caseSensitive = true): bool
Check if given string starts with specified substring.
Binary and multibyte safe.
Check if given string starts with specified substring. Binary and multibyte safe. Parameters
ReturnsReturns true if first input starts with second input, false otherwise |
# | ||||||||||
public
static
|
endsWith(string $string, string $with, bool $caseSensitive = true): bool
Check if given string ends with specified substring.
Binary and multibyte safe.
Check if given string ends with specified substring. Binary and multibyte safe. Parameters
ReturnsReturns true if first input ends with second input, false otherwise |
# | ||||||||||
public
static
|
explode(string $string, string $delimiter = ',', mixed $trim = true, bool $skipEmpty = false): array
Explodes string into array, optionally trims values and skips empty ones.
Explodes string into array, optionally trims values and skips empty ones. Parameters
|
# | ||||||||||
public
static
|
countWords(string $string): int
Counts words in a string.
Counts words in a string. |
# | ||||||||||
public
static
|
normalizeNumber(int|float|string $value): string
Returns string representation of number value with replaced commas to dots, if decimal point
of current locale is comma.
Returns string representation of number value with replaced commas to dots, if decimal point of current locale is comma. |
# | ||||||||||
public
static
|
base64UrlEncode(string $input): string
Encodes string into "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648).
Encodes string into "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648).
Parameters
Returnsencoded string. |
# | ||||||||||
public
static
|
base64UrlDecode(string $input): string
Decodes "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648).
Decodes "Base 64 Encoding with URL and Filename Safe Alphabet" (RFC 4648). Parameters
Returnsdecoded string. |
# | ||||||||||
public
static
|
floatToString(float|int $number): string
Safely casts a float to string independent of the current locale.
Safely casts a float to string independent of the current locale. The decimal separator will always be Parameters
Returnsthe string representation of the number. |
# | ||||||||||
public
static
|
matchWildcard(string $pattern, string $string, array $options = []): bool
Checks if the passed string would match the given shell wildcard pattern.
This function emulates [[fnmatch()]], which…
Checks if the passed string would match the given shell wildcard pattern. This function emulates [[fnmatch()]], which may be unavailable at certain environment, using PCRE. Parameters
Returnswhether the string matches pattern or not. |
# |