Class FormatOfString
- Namespace
- SunamoText
- Assembly
- SunamoText.dll
Provides methods for parsing and validating string formats using pipe-delimited templates. Alternatives: TextFormatData - can check whether on position is expected char (letter, digit, etc.) but then not allow variable length of parsed.
public class FormatOfString
- Inheritance
-
FormatOfString
- Inherited Members
- Extension Methods
Methods
GetParsedParts(string, string)
Parses variable parts from text using pipe-delimited format.
For example, format "{Width=|, Height=|}" applied to "{Width=100, Height=200}" returns ["100", "200"].
public static List<string> GetParsedParts(string text, string format)
Parameters
textstringThe input text to parse.
formatstringThe pipe-delimited format template where | marks variable parts.
Returns
HasFormat(string, string, bool)
Checks whether text matches the given pipe-delimited format.
public static bool HasFormat(string text, string format, bool isUsingWildcard = false)
Parameters
textstringThe input text to validate.
formatstringThe pipe-delimited format template.
isUsingWildcardboolWhen true, pipes are replaced with wildcards for pattern matching.
Returns
- bool
True if the text matches the format; otherwise false.