Class ValidationsStringExtensions
Provides extension methods for string operations, enhancing the built-in string manipulation capabilities.
Inherited Members
Namespace: BlackBytesBox.Unified.Core.Extensions.StringExtensions
Assembly: BlackBytesBox.Unified.Core.dll
Syntax
public static class ValidationsStringExtensions
Methods
| Edit this page View SourceMatchesAnyPattern(string?, IEnumerable<string>?)
Declaration
public static bool MatchesAnyPattern(this string? input, IEnumerable<string>? patterns)
Parameters
Type | Name | Description |
---|---|---|
string | input | |
IEnumerable<string> | patterns |
Returns
Type | Description |
---|---|
bool |
MatchesAnyPattern(string?, List<string>?)
Checks if the input matches any of the provided patterns.
Declaration
public static bool MatchesAnyPattern(string? input, List<string>? patterns)
Parameters
Type | Name | Description |
---|---|---|
string | input | The input string to be matched. |
List<string> | patterns | A list of patterns to match against the input. |
Returns
Type | Description |
---|---|
bool | True if any pattern matches the input; otherwise, false. |
MatchesAnyPattern(string?, string)
Declaration
public static bool MatchesAnyPattern(this string? input, string pattern)
Parameters
Type | Name | Description |
---|---|---|
string | input | |
string | pattern |
Returns
Type | Description |
---|---|
bool |
MatchesAnyPattern(string?, string[]?)
Checks if the input matches any of the provided patterns.
Declaration
public static bool MatchesAnyPattern(string? input, string[]? patterns)
Parameters
Type | Name | Description |
---|---|---|
string | input | The input string to be matched. |
string[] | patterns | A list of patterns to match against the input. |
Returns
Type | Description |
---|---|
bool | True if any pattern matches the input; otherwise, false. |
ValidateWhitelistBlacklist(string, IEnumerable<string>?, IEnumerable<string>?)
Declaration
public static bool ValidateWhitelistBlacklist(this string input, IEnumerable<string>? whitelist = null, IEnumerable<string>? blacklist = null)
Parameters
Type | Name | Description |
---|---|---|
string | input | |
IEnumerable<string> | whitelist | |
IEnumerable<string> | blacklist |
Returns
Type | Description |
---|---|
bool |
ValidateWhitelistBlacklist(string, List<string>?, List<string>?)
Extension method to evaluate this string instance against optional whitelist and blacklist patterns to determine whether the operation should continue.
Declaration
public static bool ValidateWhitelistBlacklist(this string input, List<string>? whitelist = null, List<string>? blacklist = null)
Parameters
Type | Name | Description |
---|---|---|
string | input | The string instance to be evaluated. |
List<string> | whitelist | An optional list of whitelist patterns. If the string matches any of these patterns, the method immediately returns true, indicating that the operation should continue. |
List<string> | blacklist | An optional list of blacklist patterns. If the string matches any of these patterns, the method returns false, indicating that the operation should be halted. |
Returns
Type | Description |
---|---|
bool | True if the operation should continue (either by passing a whitelist check or not failing a blacklist check), or false if the string matches a blacklist pattern and should be halted. |