C# Class i18n.Helpers.NuggetParser

Helper class for locating and processing nuggets in a string.
Exibir arquivo Open project: turquoiseowl/i18n Class Usage Examples

Public Methods

Method Description
BreakdownNugget ( string nugget ) : Nugget

Parses a nugget string to breakdown the nugget into individual components.

NuggetParser ( NuggetTokens nuggetTokens, Context context ) : System
ParseString ( string entity, Func ProcessNugget ) : string

Parses a string entity for nuggets, forwarding the nugget to a caller-provided delegate, with support for replacement of nugget strings in the entity.

Private Methods

Method Description
EscapeString ( string str, char escapeChar = '\\' ) : string

Modifies a string such that each character is prefixed by another character (defaults to backslash).

NuggetFromRegexMatch ( Match match ) : Nugget

Returns a nugget instance loaded from a regex match, or null if error.

Method Details

BreakdownNugget() public method

Parses a nugget string to breakdown the nugget into individual components.
public BreakdownNugget ( string nugget ) : Nugget
nugget string Subject nugget string.
return Nugget

NuggetParser() public method

public NuggetParser ( NuggetTokens nuggetTokens, Context context ) : System
nuggetTokens NuggetTokens
context Context
return System

ParseString() public method

Parses a string entity for nuggets, forwarding the nugget to a caller-provided delegate, with support for replacement of nugget strings in the entity.
public ParseString ( string entity, Func ProcessNugget ) : string
entity string /// String containing nuggets to be parsed. E.g. source code file, HTTP response entity. ///
ProcessNugget Func /// Delegate callback to be called for each nugget encountered in entity: /// delegate(string nuggetString, int pos, Nugget nugget1, string entity1). /// Returns a string with which to replace the nugget string in the source entity. /// If no change, then may return null. ///
return string