Strings
class Strings
String tools library.
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 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.
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 24
final
__construct()
Static class - cannot be instantiated.
at line 35
static bool
checkEncoding($s)
Checks if the string is valid for UTF-8 encoding.
at line 49
static string
fixEncoding($s)
Removes invalid code unit sequences from UTF-8 string.
at line 68
static string
chr($code)
Returns a specific character in UTF-8.
at line 83
static bool
startsWith($haystack, $needle)
Starts the $haystack string with the prefix $needle?
at line 95
static bool
endsWith($haystack, $needle)
Ends the $haystack string with the suffix $needle?
at line 107
static bool
contains($haystack, $needle)
Does $haystack contain $needle?
at line 120
static string
substring($s, $start, $length = NULL)
Returns a part of UTF-8 string.
at line 141
static string
normalize($s)
Removes special controls characters and normalizes line endings and spaces.
at line 163
static string
normalizeNewLines($s)
Standardize line endings to unix-like.
at line 174
static string
toAscii($s)
Converts to ASCII.
at line 210
static string
webalize($s, $charlist = NULL, $lower = TRUE)
Converts to web safe characters [a-z0-9-] text.
at line 229
static string
truncate($s, $maxLen, $append = "…")
Truncates string to maximal length.
at line 254
static string
indent($s, $level = 1, $chars = "\t")
Indents the content from the left.
at line 268
static string
lower($s)
Convert to lower case.
at line 279
static string
upper($s)
Convert to upper case.
at line 290
static string
firstUpper($s)
Convert first character to upper case.
at line 301
static string
capitalize($s)
Capitalize string.
at line 314
static bool
compare($left, $right, $len = NULL)
Case-insensitive compares UTF-8 strings.
at line 332
static string
findPrefix($strings)
Finds the length of common prefix of strings.
at line 358
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 370
static string
trim($s, $charlist = " \t\n\r\x00\v ")
Strips whitespace.
at line 384
static string
padLeft($s, $length, $pad = ' ')
Pad a string to a certain length with another string.
at line 399
static string
padRight($s, $length, $pad = ' ')
Pad a string to a certain length with another string.
at line 412
static string
reverse($s)
Reverse string.
at line 422
static
random($length = 10, $charlist = '0-9a-z')
deprecated
deprecated
Use Nette\Utils\Random::generate
at line 435
static array
split($subject, $pattern, $flags = 0)
Splits string by a regular expression.
at line 449
static mixed
match($subject, $pattern, $flags = 0, $offset = 0)
Performs a regular expression match.
at line 468
static array
matchAll($subject, $pattern, $flags = 0, $offset = 0)
Performs a global regular expression match.
at line 490
static string
replace($subject, $pattern, $replacement = NULL, $limit = -1)
Perform a regular expression search and replace.
at line 512
static
pcre($func, $args)
internal |
No description