C# Класс i18n.Helpers.NuggetParser

Helper class for locating and processing nuggets in a string.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

BreakdownNugget() публичный Метод

Parses a nugget string to breakdown the nugget into individual components.
public BreakdownNugget ( string nugget ) : Nugget
nugget string Subject nugget string.
Результат Nugget

NuggetParser() публичный Метод

public NuggetParser ( NuggetTokens nuggetTokens, Context context ) : System
nuggetTokens NuggetTokens
context Context
Результат System

ParseString() публичный Метод

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. ///
Результат string