Class Parser
Parses a format string.
Namespace: UnityEngine.Localization.SmartFormat.Core.Parsing
Syntax
[Serializable]
public class Parser
Constructors
Parser(SmartSettings)
Declaration
public Parser(SmartSettings settings)
Parameters
Type | Name | Description |
---|---|---|
SmartSettings | settings |
Properties
Settings
Gets or sets the SmartSettings for Smart.Format
Declaration
public SmartSettings Settings { get; set; }
Property Value
Type | Description |
---|---|
SmartSettings |
Methods
AddAdditionalSelectorChars(String)
Adds specific characters to the allowed selector chars.
Declaration
public void AddAdditionalSelectorChars(string chars)
Parameters
Type | Name | Description |
---|---|---|
String | chars |
AddAlphanumericSelectors()
Includes a-z and A-Z in the list of allowed selector chars.
Declaration
public void AddAlphanumericSelectors()
AddOperators(String)
Adds specific characters to the allowed operator chars. An operator is a character that is in the selector string that splits the selectors.
Declaration
public void AddOperators(string chars)
Parameters
Type | Name | Description |
---|---|---|
String | chars |
ParseFormat(String, String[])
Declaration
public Format ParseFormat(string format, string[] formatterExtensionNames)
Parameters
Type | Name | Description |
---|---|---|
String | format | |
String[] | formatterExtensionNames |
Returns
Type | Description |
---|---|
Format |
UseAlternativeBraces(Char, Char)
Declaration
public void UseAlternativeBraces(char opening, char closing)
Parameters
Type | Name | Description |
---|---|---|
Char | opening | |
Char | closing |
UseAlternativeEscapeChar(Char)
Sets the AlternativeEscaping option to True so that braces will only be escaped after the specified character.
Declaration
public void UseAlternativeEscapeChar(char alternativeEscapeChar = '\\')
Parameters
Type | Name | Description |
---|---|---|
Char | alternativeEscapeChar | Defaults to backslash |
UseBraceEscaping()
[Default] Uses {{ and }} for escaping braces for compatibility with String.Format. However, this does not work very well with nested placeholders, so it is recommended to use an alternative escape char.
Declaration
public void UseBraceEscaping()
Events
OnParsingFailure
Event raising, if an error occurs during parsing.
Declaration
public event EventHandler<ParsingErrorEventArgs> OnParsingFailure
Event Type
Type | Description |
---|---|
EventHandler<ParsingErrorEventArgs> |