Show / Hide Table of Contents

Class StringValidation

Validates a string

Inheritance
object
StringValidation
Inherited Members
object.GetType()
object.MemberwiseClone()
object.ToString()
object.Equals(object)
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetHashCode()
Namespace: SadConsole
Assembly: SadConsole.dll
Syntax
public static class StringValidation

Methods

All(params Validator[])

Uses multiple StringValidation.Validator delegates to validate a string. All validators must pass.

Declaration
public static StringValidation.Validator All(params StringValidation.Validator[] validators)
Parameters
Type Name Description
Validator[] validators

Each StringValidation.Validator to use.

Returns
Type Description
StringValidation.Validator

When all validators pass, a successful result; otherwise, the failed result.

Decimal(string)

Returns a StringValidation.Validator delegate that validates whether or not a string can be parsed by the TryParse(string, out double).

Declaration
public static StringValidation.Validator Decimal(string errorMessage)
Parameters
Type Name Description
string errorMessage

A message to provide to the result if the validation fails.

Returns
Type Description
StringValidation.Validator

The validation result.

Integer(string)

Returns a StringValidation.Validator delegate that validates whether or not a string can be parsed by the TryParse(string, out long).

Declaration
public static StringValidation.Validator Integer(string errorMessage)
Parameters
Type Name Description
string errorMessage

A message to provide to the result if the validation fails.

Returns
Type Description
StringValidation.Validator

The validation result.

LengthRange(int, int, string)

Returns a StringValidation.Validator delegate that validates whether or not a length of a string falls within the specified range.

Declaration
public static StringValidation.Validator LengthRange(int min, int max, string errorMessage)
Parameters
Type Name Description
int min
int max
string errorMessage

A message to provide to the result if the validation fails.

Returns
Type Description
StringValidation.Validator

The validation result.

Letters(string)

Returns a StringValidation.Validator delegate that validates whether a string contains only letters.

Declaration
public static StringValidation.Validator Letters(string errorMessage)
Parameters
Type Name Description
string errorMessage

A message to provide to the result if the validation fails.

Returns
Type Description
StringValidation.Validator

The validation result.

None(string)

Always validates to true.

Declaration
public static StringValidation.Result None(string input)
Parameters
Type Name Description
string input

The string to validate.

Returns
Type Description
StringValidation.Result

A positive validation result.

In this article

Back to top

Back to top Generated by DocFX