Strings
class Strings
String tools library.
Constants
TRIM_CHARACTERS |
|
Methods
Static class - cannot be instantiated.
Checks if the string is valid for UTF-8 encoding.
Removes invalid code unit sequences from UTF-8 string.
Returns a specific character in UTF-8.
Starts the $haystack string with the prefix $needle?
Ends the $haystack string with the suffix $needle?
Does $haystack contain $needle?
Returns a part of UTF-8 string.
Removes special controls characters and normalizes line endings and spaces.
Standardize line endings to unix-like.
Converts to ASCII.
Converts to web safe characters [a-z0-9-] text.
Truncates string to maximal length.
Indents the content from the left.
Convert to lower case.
Convert first character to lower case.
Convert to upper case.
Convert first character to upper case.
Capitalize string.
Case-insensitive compares UTF-8 strings.
Finds the length of common prefix of strings.
Returns number of characters (not bytes) in UTF-8 string.
Strips whitespace.
Pad a string to a certain length with another string.
Pad a string to a certain length with another string.
Reverse string.
Returns part of $haystack before $nth occurence of $needle.
Returns part of $haystack after $nth occurence of $needle.
Splits string by a regular expression.
Performs a regular expression match.
Performs a global regular expression match.
Perform a regular expression search and replace.
No description
Details
at line 25
final
__construct()
Static class - cannot be instantiated.
at line 36
static bool
checkEncoding($s)
Checks if the string is valid for UTF-8 encoding.
at line 47
static string
fixEncoding($s)
Removes invalid code unit sequences from UTF-8 string.
at line 64
static string
chr($code)
Returns a specific character in UTF-8.
at line 79
static bool
startsWith($haystack, $needle)
Starts the $haystack string with the prefix $needle?
at line 91
static bool
endsWith($haystack, $needle)
Ends the $haystack string with the suffix $needle?
at line 103
static bool
contains($haystack, $needle)
Does $haystack contain $needle?
at line 116
static string
substring($s, $start, $length = NULL)
Returns a part of UTF-8 string.
at line 137
static string
normalize($s)
Removes special controls characters and normalizes line endings and spaces.
at line 159
static string
normalizeNewLines($s)
Standardize line endings to unix-like.
at line 170
static string
toAscii($s)
Converts to ASCII.
at line 214
static string
webalize($s, $charlist = NULL, $lower = TRUE)
Converts to web safe characters [a-z0-9-] text.
at line 233
static string
truncate($s, $maxLen, $append = "…")
Truncates string to maximal length.
at line 258
static string
indent($s, $level = 1, $chars = "\t")
Indents the content from the left.
at line 272
static string
lower($s)
Convert to lower case.
at line 283
static string
firstLower($s)
Convert first character to lower case.
at line 294
static string
upper($s)
Convert to upper case.
at line 305
static string
firstUpper($s)
Convert first character to upper case.
at line 316
static string
capitalize($s)
Capitalize string.
at line 329
static bool
compare($left, $right, $len = NULL)
Case-insensitive compares UTF-8 strings.
at line 347
static string
findPrefix($strings)
Finds the length of common prefix of strings.
at line 373
static int
length($s)
Returns number of characters (not bytes) in UTF-8 string.
That is the number of Unicode code points which may differ from the number of graphemes.
at line 385
static string
trim($s, $charlist = self::TRIM_CHARACTERS)
Strips whitespace.
at line 399
static string
padLeft($s, $length, $pad = ' ')
Pad a string to a certain length with another string.
at line 414
static string
padRight($s, $length, $pad = ' ')
Pad a string to a certain length with another string.
at line 427
static string
reverse($s)
Reverse string.
at line 437
static
random($length = 10, $charlist = '0-9a-z')
deprecated
deprecated
Use Nette\Utils\Random::generate
at line 450
static string|false
before($haystack, $needle, $nth = 1)
Returns part of $haystack before $nth occurence of $needle.
at line 466
static string|false
after($haystack, $needle, $nth = 1)
Returns part of $haystack after $nth occurence of $needle.
at line 512
static array
split($subject, $pattern, $flags = 0)
Splits string by a regular expression.
at line 526
static mixed
match($subject, $pattern, $flags = 0, $offset = 0)
Performs a regular expression match.
at line 545
static array
matchAll($subject, $pattern, $flags = 0, $offset = 0)
Performs a global regular expression match.
at line 567
static string
replace($subject, $pattern, $replacement = NULL, $limit = -1)
Perform a regular expression search and replace.
at line 589
static
pcre($func, $args)
internal |
No description