Strings
class Strings (View source)
Functions useful for validating strings.
Properties
protected Application | $app |
Methods
Returns true on whether the passed string is completely alpha-numeric, if the value is not a string or is an empty string false will be returned.
Returns true if the passed string is a valid "handle" (e.g. only letters, numbers, or a _ symbol).
Returns false if the string is empty (including trim()).
Returns true on whether the passed string is larger or equal to the passed length.
Returns true on whether the passed is smaller or equal to the passed length.
Returns 0 if there are no numbers in the string, or returns the number of numbers in the string.
Returns 0 if there are no upper case letters in the string, or returns the number of upper case letters in the string.
Returns 0 if there are no lower case letters in the string, or returns the number of lower case letters in the string.
Returns 0 if there are no symbols in the string, or returns the number of symbols in the string.
Check if a variable contains a valid regular expression.
Details
__construct(Application $app)
No description
bool
email(string $em, bool $testMXRecord = false, bool $strict = false)
deprecated
deprecated
No description
bool
alphanum(string $value, bool $allowSpaces = false, bool $allowDashes = false)
Returns true on whether the passed string is completely alpha-numeric, if the value is not a string or is an empty string false will be returned.
bool
handle(string $handle)
Returns true if the passed string is a valid "handle" (e.g. only letters, numbers, or a _ symbol).
bool
notempty(string $field)
Returns false if the string is empty (including trim()).
bool
min(string $str, int $length)
Returns true on whether the passed string is larger or equal to the passed length.
bool
max(string $str, int $length)
Returns true on whether the passed is smaller or equal to the passed length.
int
containsNumber(string $str)
Returns 0 if there are no numbers in the string, or returns the number of numbers in the string.
int
containsUpperCase(string $str)
Returns 0 if there are no upper case letters in the string, or returns the number of upper case letters in the string.
int
containsLowerCase(string $str)
Returns 0 if there are no lower case letters in the string, or returns the number of lower case letters in the string.
int
containsSymbol(string $str)
Returns 0 if there are no symbols in the string, or returns the number of symbols in the string.
bool
isValidRegex(string|mixed $pattern, bool $includesDelimiters = true)
Check if a variable contains a valid regular expression.