Show / Hide Table of Contents

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 fits to given . Also gets extracted values.

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.

Extension Methods

AbpObjectExtensions.As<T>(Object)
AbpObjectExtensions.To<T>(Object)
AbpObjectExtensions.IsIn<T>(T, T[])
AbpObjectExtensions.If<T>(T, Boolean, Func<T, T>)
AbpObjectExtensions.If<T>(T, Boolean, Action<T>)
LockExtensions.Locking(Object, Action)
LockExtensions.Locking<T>(T, Action<T>)
LockExtensions.Locking<TResult>(Object, Func<TResult>)
LockExtensions.Locking<T, TResult>(T, Func<T, TResult>)
Back to top Powered by Volosoft