Show / Hide Table of Contents

Class ValidateUtility

Provides validation utilities.

Inheritance
System.Object
ValidateUtility
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ToString()
System.Object.ReferenceEquals(System.Object, System.Object)
Namespace: Celerik.NetCore.Util
Assembly: cs.temp.dll.dll
Syntax
public static class ValidateUtility

Fields

EmailRegex

Regex for emails.

Declaration
public const string EmailRegex = "^(([^<>()\\[\\]\\\\.,;:\\s@\"]+(\\.[^<>()\\[\\]\\\\.,;:\\s@\"]+)*)|(\".+\"))@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$"
Field Value
Type Description
System.String

PersonNameRegex

Regex for names (only letters and spaces are allowed).

Declaration
public const string PersonNameRegex = "^[A-zÀ-ú]+(([',. -][A-zÀ-ú ])?[A-zÀ-ú]*)*$"
Field Value
Type Description
System.String

StandardPasswordRegex

Regex for standard passwords. They should be between 8-50 characteres and should include an upper letter, a lower letter, a number and a symbol: #$^+=!*()@%&

Declaration
public const string StandardPasswordRegex = "^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d)(?=.*[#$^+=!*()@%&]).{8,50}$"
Field Value
Type Description
System.String

TableNameRegex

Regex for database table names.

Declaration
public const string TableNameRegex = "^[A-Za-z][A-Za-z0-9]{2,62}$"
Field Value
Type Description
System.String

ZipPlus4Regex

Regex for ZIP codes (U.S. postal code), allowing both the five-digit and nine-digit (called ZIP+4) formats.

Declaration
public const string ZipPlus4Regex = "^[0-9]{5}(?:-[0-9]{4})?$"
Field Value
Type Description
System.String

Methods

IsValidBool(String)

Validates whether this string is a valid boolean. The following are the valid boolean values: "true", "True", "TRUE", "false", "False", "FALSE".

Declaration
public static bool IsValidBool(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid boolean.

IsValidDateInvariant(String)

Validates whether this string is a valid DateTime with invariant culture.

Declaration
public static bool IsValidDateInvariant(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid DateTime with invariant culture.

IsValidDecimalInvariant(String)

Validates whether this string is a valid Decimal with invariant culture.

Declaration
public static bool IsValidDecimalInvariant(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid Decimal.

IsValidDoubleInvariant(String)

Validates whether this string is a valid Double with invariant culture.

Declaration
public static bool IsValidDoubleInvariant(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid Double.

IsValidEmail(String)

Validates wheter this string has a valid email format.

Declaration
public static bool IsValidEmail(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string has a valid email format.

IsValidFloatInvariant(String)

Validates whether this string is a valid Float with invariant culture.

Declaration
public static bool IsValidFloatInvariant(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid Float.

IsValidInternationalPhone(String)

Validates wheter this string is a valid international phone number E.164 compilant.

Declaration
public static bool IsValidInternationalPhone(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True this string is a valid phone number E.164 compilant.

IsValidIntInvariant(String)

Validates whether this string is a valid Int with invariant culture.

Declaration
public static bool IsValidIntInvariant(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid Int.

IsValidPersonName(String)

Validates wheter this string has a valid name format (only letters and spaces are allowed).

Declaration
public static bool IsValidPersonName(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string has a valid name format.

IsValidStandardPassword(String)

Validates wheter this string is a valid standard password. It should be between 8-50 characteres and should include an upper letter, a lower letter, a number and a symbol: #$^+=!*()@%&

Declaration
public static bool IsValidStandardPassword(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid password.

IsValidTableName(String)

Validates wheter this string is a valid databse table name.

Declaration
public static bool IsValidTableName(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid databse table name.

IsValidUrl(String)

Validates whether this string is a valid url.

Declaration
public static bool IsValidUrl(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid Url.

IsValidZipPlus4(String)

Validates wheter this string is a valid zip code (U.S. postal code), allowing both the five-digit and nine-digit (called ZIP+4) formats.

Declaration
public static bool IsValidZipPlus4(this string str)
Parameters
Type Name Description
System.String str

The string to validate.

Returns
Type Description
System.Boolean

True if this string is a valid zip code.

In This Article
Back to top Generated by DocFX