Class Strings

Functions useful for validating strings

Methods summary

public boolean
# email( string $em, boolean $testMXRecord = false, boolean $strict = false )

Returns true if the provided email is valid

public boolean
# alphanum( string $value, boolean $allowSpaces = false, boolean $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.

public boolean
# handle( string $handle )

Returns true if the passed string is a valid "handle" (e.g. only letters, numbers, or a _ symbol)

public boolean
# notempty( string $field )

Returns false if the string is empty (including trim())

public boolean
# min( string $str, integer $length )

Returns true on whether the passed string is larger or equal to the passed length

public boolean
# max( string $str, integer $length )

Returns true on whether the passed is smaller or equal to the passed length

public integer
# containsNumber( string $str )

Returns 0 if there are no numbers in the string, or returns the number of numbers in the string

public integer
# 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

public integer
# 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

public integer
# containsSymbol( string $str )

Returns 0 if there are no symbols in the string, or returns the number of symbols in the string