Class Parser | Localization | 0.9.0-preview
docs.unity3d.com
    Show / Hide Table of Contents

    Class Parser

    Parses a format string.

    Inheritance
    Object
    Parser
    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>
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023