Rules

data object Rules

Predefined rules for form validation.

See also

Properties

Link copied to clipboard

A rule that requires the input to contain only letters or digits.

Link copied to clipboard

A rule that requires the input to have digits only

Link copied to clipboard

A rule that requires the input to have digits only

Link copied to clipboard

A rule that requires the input to have at least one digit

Link copied to clipboard

A rule that requires the input to have at least one letter

Link copied to clipboard

Input must contain at least one uppercase unicode letter

Link copied to clipboard

A rule that requires the input to have letters only

Link copied to clipboard

A rule that requires the input to be lowercase

Link copied to clipboard

A rule that requires the input to have no digits

Link copied to clipboard

A rule that requires the input to not have any letters

Link copied to clipboard

A rule that requires that the string is not blank, does not contain spaces only, and is not equal to "null". "null" text is not a valid value.

Link copied to clipboard

A rule that requires the input to have no whitespace characters

Link copied to clipboard

A rule that requires the input to have no newline characters ('\n' or '\r').

Link copied to clipboard

A rule that requires the input to be upper case

Functions

Link copied to clipboard
fun Contains(needle: String, ignoreCase: Boolean = false): Rule

A rule that requires the input to contain needle

Link copied to clipboard
fun EndsWith(suffix: String, ignoreCase: Boolean = false): Rule

A rule that requires the input to end with suffix

Link copied to clipboard
fun Equals(other: String, ignoreCase: Boolean = false): Rule

A rule that requires the input to be equal to the other string.

Link copied to clipboard
fun LengthExact(length: Int): Rule

Length must be exactly length characters

Link copied to clipboard

A rule that checks that the input fits the range

Link copied to clipboard
fun LongerThan(minLength: Int): Rule

A rule that requires length to be longer than minLength

Link copied to clipboard
fun Matches(pattern: Regex): Rule

A rule that requires to input to match pattern

Link copied to clipboard
fun ShorterThan(maxLength: Int): Rule

A rule that requires length to be shorter than maxLength

Link copied to clipboard
fun StartsWith(prefix: String, ignoreCase: Boolean = false): Rule

A rule that requires the input to start with prefix