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

    Class Format

    Represents a parsed format string. Contains a list of FormatItems, including LiteralTexts and Placeholders.

    Inheritance
    Object
    FormatItem
    Format
    Inherited Members
    FormatItem.baseString
    FormatItem.endIndex
    FormatItem.SmartSettings
    FormatItem.startIndex
    FormatItem.RawText
    Namespace: UnityEngine.Localization.SmartFormat.Core.Parsing
    Syntax
    public class Format : FormatItem

    Constructors

    Format(SmartSettings, String)

    Declaration
    public Format(SmartSettings smartSettings, string baseString)
    Parameters
    Type Name Description
    SmartSettings smartSettings
    String baseString

    Format(SmartSettings, Placeholder, Int32)

    Declaration
    public Format(SmartSettings smartSettings, Placeholder parent, int startIndex)
    Parameters
    Type Name Description
    SmartSettings smartSettings
    Placeholder parent
    Int32 startIndex

    Fields

    parent

    Declaration
    public readonly Placeholder parent
    Field Value
    Type Description
    Placeholder

    Properties

    HasNested

    Declaration
    public bool HasNested { get; set; }
    Property Value
    Type Description
    Boolean

    Items

    Declaration
    public List<FormatItem> Items { get; }
    Property Value
    Type Description
    List<FormatItem>

    Methods

    GetLiteralText()

    Retrieves the literal text contained in this format. Excludes escaped chars, and does not include the text of placeholders

    Declaration
    public string GetLiteralText()
    Returns
    Type Description
    String

    IndexOf(Char)

    Searches the literal text for the search char. Does not search in nested placeholders.

    Declaration
    public int IndexOf(char search)
    Parameters
    Type Name Description
    Char search
    Returns
    Type Description
    Int32

    IndexOf(Char, Int32)

    Searches the literal text for the search char. Does not search in nested placeholders.

    Declaration
    public int IndexOf(char search, int startIndex)
    Parameters
    Type Name Description
    Char search
    Int32 startIndex
    Returns
    Type Description
    Int32

    Split(Char)

    Declaration
    public IList<Format> Split(char search)
    Parameters
    Type Name Description
    Char search
    Returns
    Type Description
    IList<Format>

    Split(Char, Int32)

    Declaration
    public IList<Format> Split(char search, int maxCount)
    Parameters
    Type Name Description
    Char search
    Int32 maxCount
    Returns
    Type Description
    IList<Format>

    Substring(Int32)

    Returns a substring of the current Format.

    Declaration
    public Format Substring(int startIndex)
    Parameters
    Type Name Description
    Int32 startIndex
    Returns
    Type Description
    Format

    Substring(Int32, Int32)

    Returns a substring of the current Format.

    Declaration
    public Format Substring(int startIndex, int length)
    Parameters
    Type Name Description
    Int32 startIndex
    Int32 length
    Returns
    Type Description
    Format

    ToString()

    Reconstructs the format string, but doesn't include escaped chars and tries to reconstruct placeholders.

    Declaration
    public override string ToString()
    Returns
    Type Description
    String
    Overrides
    FormatItem.ToString()
    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