docs.unity3d.com
    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 © 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