Class FormattedStringValueExtracter
This class is used to extract dynamic values from a formatted string.
It works as reverse of
Inheritance
System.Object
FormattedStringValueExtracter
Namespace: Volo.Abp.Text.Formatting
Assembly: Volo.Abp.Core.dll
Syntax
public class FormattedStringValueExtracter : object
Examples
Say that str is "My name is Neo." and format is "My name is {name}.". Then Extract method gets "Neo" as "name".
Methods
Extract(String, String, Boolean)
Extracts dynamic values from a formatted string.
Declaration
public static FormattedStringValueExtracter.ExtractionResult Extract(string str, string format, bool ignoreCase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | String including dynamic values |
| System.String | format | Format of the string |
| System.Boolean | ignoreCase | True, to search case-insensitive. |
Returns
| Type | Description |
|---|---|
| FormattedStringValueExtracter.ExtractionResult |
IsMatch(String, String, out String[], Boolean)
Checks if given
Declaration
public static bool IsMatch(string str, string format, out string[] values, bool ignoreCase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | String including dynamic values |
| System.String | format | Format of the string |
| System.String[] | values | Array of extracted values if matched |
| System.Boolean | ignoreCase | True, to search case-insensitive |
Returns
| Type | Description |
|---|---|
| System.Boolean | True, if matched. |