Skip to content

StringValidationExtensions Class ​

Definition ​

Extension methods for validation operations on the string datatype

  • Namespace: JASE.Extensions
  • Assembly: JASE.Primitives.dll

Methods ​

NameDescription
bool ContainsLower(string input)Returns true if string contains any lowercase alpha characters
bool ContainsNumeric(string input)Returns true if string contains any numeric characters
bool ContainsSpecialCharacters(string input, string specialChars = null)Returns true if string contains any defined special characters characters
bool ContainsUpper(string input)Returns true if string contains any uppercase alpha characters
bool HasLower(string input)Returns true if the input contains at least one lowercase character
bool HasNumeric(string input)Returns true if the input contains a numeric value
bool HasSymbol(string input)Returns true if the input contains a symbol value
bool HasUpper(string input)Returns true if the input contain at least one uppercase character
bool IsBase64(string input)Checks string to see if it appears to possibly be Base64 encoded
bool IsBase64(string input, out byte[] output)Checks string to see if it appears to possibly be Base64 encoded
bool IsBool(string input)Returns if the input value can be successfully parsed as a boolean. See IsBool for accepted tokens.
bool IsBool(string input, out bool value)Returns true if the input value can be successfully parsed as a boolean value. Recognized (case-insensitive, trimmed): true/yes/1 and false/no/0.
bool IsDateTime(string input, CultureInfo culture = null, bool exactOnly = null)Attempts to parse the string based known rRet time string formats
bool IsDateTime(string input, out DateTime date, CultureInfo culture = null, bool exactOnly = null)Attempts to parse the string based known rRet time string formats
bool IsDateTime(string input, out DateTimeOffset date, CultureInfo culture = null, bool exactOnly = null)Attempts to parse the string based known rRet time string formats
bool IsDateTimeKeyword(string input)Checks if the string is a known DateTime keyword that can be resolved with ResolveDateTimeKeyword
bool IsDateTimeKeyword(string input, out DateTime? dateTime)Checks if the string is a known DateTime keyword that can be resolved with ResolveDateTimeKeyword
bool IsDateTimeKeyword(string input, out DateTimeOffset? dateTime)Checks if the string is a known DateTime keyword that can be resolved with ResolveDateTimeKeyword
bool IsEmail(string input)Checks if string appears to be a valid email address
bool IsHtml(string input)Returns true if string can be loaded as HTML by HtmlAgilityPack
bool IsJson(string input)Returns when input is a valid JSON object or array.
bool IsNumeric(string input)Returns true if the input value is entirely numeric
bool IsNumeric(string input, out decimal value)Returns true if the input value is entirely numeric
bool IsPhone(string input)Returns true if string appears to be a US phone number
bool IsQuoted(string input)Checks if input string is wrapped in quote characters
bool IsQuoted(string input, out string unquoted)Checks if input string is wrapped in quote characters
bool IsSnakeCased(string str)Checks if provided string is snaked_cased
bool IsSqlLike(string input, string pattern)Returns true if string appears to mimic an SQL LIKE clause
bool IsUid(string input)Returns true if string can be successfully parsed as a Guid
bool IsUid(string input, out Guid uid)Returns true if string can be successfully parsed as a Guid
bool IsUnc(string input)Returns true if string appears to be a UNC file path
bool IsUri(string input, bool suppressException = null)Returns true is string can be parsed into a valid Uri
bool IsUri(string input, out Uri uri, bool suppressException = null)Returns true is string can be parsed into a valid Uri
bool IsUSPhone(string input)Returns true if string appears to be a US phone number