Empeld
Empeld plugin documentation.
|
Fast implementation of a string tokenizer. Tokens exist like {token} More...
Public Member Functions | |
TokenizedString (string str) | |
Create a tokenized string from a normal string More... | |
bool | SetToken (string token, string val) |
Sets a token in the instance of a string to a value More... | |
bool | SetToken (string token, object val) |
Sets a token in the instance of the string. More... | |
bool | SetToken (string token, string format, params object[] args) |
Helper: Sets a token to the formatted string More... | |
int | SetTokens (IDictionary< string, object > vals) |
Sets tokens given a dictionary of items More... | |
void | ClearTokens () |
Reset all tokens to be empty string More... | |
Static Public Member Functions | |
static string | Render (string str, IDictionary< string, object > tokens) |
Helper method to render a new string, given one with tokens, and a mapping dictionary More... | |
static string | Render (string str, object model) |
Render helper to create a string from a tokenized one and an anonymous model More... | |
Public Attributes | |
readonly string | OriginalString |
The original string with tokens intact More... | |
Properties | |
int | Segments [get] |
The total number of token segments More... | |
int | TokenCount [get] |
The total number of replaceable tokens More... | |
IEnumerable< string > | Tokens [get] |
An enumerable representing the token names More... | |
Fast implementation of a string tokenizer. Tokens exist like {token}
pluginbase.Helpers.Data.TokenizedString.TokenizedString | ( | string | str | ) |
Create a tokenized string from a normal string
str | String. |
Attribute: i
;
Attribute: i + 1
: (char)0;
Attribute: parts[0]
= new Token
Attribute: 1
: null
void pluginbase.Helpers.Data.TokenizedString.ClearTokens | ( | ) |
|
static |
Helper method to render a new string, given one with tokens, and a mapping dictionary
str | String. |
tokens | Tokens. |
|
static |
Render helper to create a string from a tokenized one and an anonymous model
str | String. |
model | Model. |
Attribute: prop.Name
= prop.GetValue(model, null);
bool pluginbase.Helpers.Data.TokenizedString.SetToken | ( | string | token, |
string | val | ||
) |
Sets a token in the instance of a string to a value
true
, if token was set, false
otherwise.token | Token. |
val | Value. |
Attribute: tok.Pos
= val;
bool pluginbase.Helpers.Data.TokenizedString.SetToken | ( | string | token, |
object | val | ||
) |
Sets a token in the instance of the string.
true
, if token was set, false
otherwise.token | Token. |
val | Value. |
Attribute: tok.Pos
= formattable.ToString(tok.Format, null);
Attribute: tok.Pos
= val.ToString();
bool pluginbase.Helpers.Data.TokenizedString.SetToken | ( | string | token, |
string | format, | ||
params object [] | args | ||
) |
Helper: Sets a token to the formatted string
true
, if token was set, false
otherwise.token | Token. |
format | Format. |
args | Arguments. |
int pluginbase.Helpers.Data.TokenizedString.SetTokens | ( | IDictionary< string, object > | vals | ) |
Sets tokens given a dictionary of items
vals | Vals. |
readonly string pluginbase.Helpers.Data.TokenizedString.OriginalString |
The original string with tokens intact
|
get |
The total number of token segments
The segments.
|
get |
The total number of replaceable tokens
The token count.
|
get |
An enumerable representing the token names
The tokens.