C# Class StringFormatEx.ExtendedStringFormatter

Exibir arquivo Open project: qstarin/StringFormatEx Class Usage Examples

Public Methods

Method Description
AddPlugin ( IStringFormatterPlugin plugin ) : void
AddPlugins ( IEnumerable plugins ) : void
CreateDefault ( ) : ExtendedStringFormatter
CreateDefaultPlugins ( ) : IStringFormatterPlugin[]
CreateDefaultThatThrowsOnErrors ( ) : ExtendedStringFormatter
FormatEx ( IFormatProvider formatProvider, string format ) : string

Formats the format string using the parameters provided.

FormatEx ( string format ) : string
FormatEx ( Stream output, IFormatProvider formatProvider, string format ) : void
FormatEx ( Stream output, string format ) : void
FormatEx ( StringBuilder output, IFormatProvider formatProvider, string format ) : void
FormatEx ( StringBuilder output, string format ) : void
FormatEx ( TextWriter output, IFormatProvider formatProvider, string format ) : void
FormatEx ( TextWriter output, string format ) : void

Private Methods

Method Description
FormatExInternal ( CustomFormatInfo info ) : void

Does the actual work.

NextPlaceholder ( string format, int startIndex, int endIndex, PlaceholderInfo &placeholder ) : bool

Returns True if the placeholder was formatted correctly; False if a placeholder couldn't be found. Outputs all relevant placeholder information. This function takes the place of the Regular Expression. It is faster and more direct, and does not suffer from Regex endless loops. In tests, this nearly doubles the speed vs Regex.

OnExtendFormatEvent ( ExtendFormatEventArgs e ) : void
OnExtendSourceEvent ( ExtendSourceEventArgs e ) : void
OnInvalidFormat ( string format, CustomFormatInfo info, PlaceholderInfo placeholder, Exception ex ) : void

Determines what to do when an Invalid Selector is found.

OnInvalidSelector ( string format, CustomFormatInfo info, PlaceholderInfo placeholder ) : bool

Determines what to do when an Invalid Selector is found. Returns True if we should just continue; False if we should skip this item.

Method Details

AddPlugin() public method

public AddPlugin ( IStringFormatterPlugin plugin ) : void
plugin IStringFormatterPlugin
return void

AddPlugins() public method

public AddPlugins ( IEnumerable plugins ) : void
plugins IEnumerable
return void

CreateDefault() public static method

public static CreateDefault ( ) : ExtendedStringFormatter
return ExtendedStringFormatter

CreateDefaultPlugins() public static method

public static CreateDefaultPlugins ( ) : IStringFormatterPlugin[]
return IStringFormatterPlugin[]

CreateDefaultThatThrowsOnErrors() public static method

public static CreateDefaultThatThrowsOnErrors ( ) : ExtendedStringFormatter
return ExtendedStringFormatter

FormatEx() public method

Formats the format string using the parameters provided.
public FormatEx ( IFormatProvider formatProvider, string format ) : string
formatProvider IFormatProvider
format string
return string

FormatEx() public method

public FormatEx ( string format ) : string
format string
return string

FormatEx() public method

public FormatEx ( Stream output, IFormatProvider formatProvider, string format ) : void
output Stream
formatProvider IFormatProvider
format string
return void

FormatEx() public method

public FormatEx ( Stream output, string format ) : void
output Stream
format string
return void

FormatEx() public method

public FormatEx ( StringBuilder output, IFormatProvider formatProvider, string format ) : void
output StringBuilder
formatProvider IFormatProvider
format string
return void

FormatEx() public method

public FormatEx ( StringBuilder output, string format ) : void
output StringBuilder
format string
return void

FormatEx() public method

public FormatEx ( TextWriter output, IFormatProvider formatProvider, string format ) : void
output System.IO.TextWriter
formatProvider IFormatProvider
format string
return void

FormatEx() public method

public FormatEx ( TextWriter output, string format ) : void
output System.IO.TextWriter
format string
return void