docs.unity.cn
    Show / Hide Table of Contents

    Sub String Formatter

    Use SubString Formatter to output parts of an input string. If the value is not a string it is first converted to one using the value’s ToString method.

    Diagram showing the breakdown of the Smart String and how each part is evaluated.

    Diagram showing the breakdown of the Smart String and how each part is evaluated.

    Field Description
    Parameter Delimiter The character used to separate the start and length value. By default it uses a comma.
    Null Display String The string to display if the string being formatter is null.
    Out Of Range Behavior Defines what to do if the substring position or length goes out of the range of the provided string.
    • Return Empty String - Returns String.Empty.
    • Return Start Index To End Of String - Returns the remainder of the string starting at start index.
    • Throw Exception - Throws a FormattingException.
    Example Smart String Arguments Result
    {0:substr(5)} "Long John" John
    {0:substr(0, 3)} "New York" New
    Hello {name:substr(1)} {surname}
    new { name = "Lara", surname = "Croft" }
    
    Hello L Croft
    Back to top Copyright © 2020 Unity Technologies
    Generated by DocFX
    on Thursday, October 28, 2021