{!See https://docs.google.com/document/d/1takg_GmIBBKKTj-GHZCwzxohpQz7Bhekivkk72kYMtE/edit for reference implementation of OneTrust, dataLayer and GTM} {!OneTrust Cookies Consent} {!OneTrust Cookies Consent end} {!dataLayer initialization push} {!dataLayer initialization push end} {!Google Tag Manager} {!Google Tag Manager end} Method Substring | Collections | 2.3.0-pre.3
docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method Substring

    Substring<T>(ref T, int, int)

    Retrieves a substring of this string. The substring starts from a specific character index, and has a specified length.

    Declaration
    public static T Substring<T>(this ref T str, int startIndex, int length) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T str

    A string to get the substring from.

    int startIndex

    Start index of substring.

    int length

    Length of substring.

    Returns
    Type Description
    T

    A new string with length equivalent to length that begins at startIndex.

    Type Parameters
    Name Description
    T

    A string type.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if startIndex or length parameter is negative, or if startIndex is larger than the string length.

    Substring<T>(ref T, int)

    Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string.

    Declaration
    public static T Substring<T>(this ref T str, int startIndex) where T : unmanaged, INativeList<byte>, IUTF8Bytes
    Parameters
    Type Name Description
    T str

    A string to get the substring from.

    int startIndex

    Start index of substring.

    Returns
    Type Description
    T

    A new string that begins at startIndex.

    Type Parameters
    Name Description
    T

    A string type.

    Substring(ref NativeText, int, int, AllocatorHandle)

    Retrieves a substring from this string. The substring starts from a specific character index, and has a specified length. Allocates memory to the new substring with the allocator specified.

    Declaration
    public static NativeText Substring(this ref NativeText str, int startIndex, int length, AllocatorManager.AllocatorHandle allocator)
    Parameters
    Type Name Description
    NativeText str

    A NativeText string to get the substring from.

    int startIndex

    Start index of substring.

    int length

    Length of substring.

    AllocatorManager.AllocatorHandle allocator

    The AllocatorManager.AllocatorHandle allocator type to use.

    Returns
    Type Description
    NativeText

    A NativeText string with a length equivalent to length that starts at startIndex and an allocator type of allocator.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if startIndex or length parameter is negative, or if startIndex is larger than string length.

    Substring(ref NativeText, int, AllocatorHandle)

    Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string. Allocates memory to the new substring with the allocator specified.

    Declaration
    public static NativeText Substring(this ref NativeText str, int startIndex, AllocatorManager.AllocatorHandle allocator)
    Parameters
    Type Name Description
    NativeText str

    A NativeText string to get the substring from.

    int startIndex

    Start index of substring.

    AllocatorManager.AllocatorHandle allocator

    The AllocatorManager.AllocatorHandle allocator type to use.

    Returns
    Type Description
    NativeText

    A NativeText string that begins at startIndex and has an allocator of type allocator.

    Substring(ref NativeText, int, int)

    Retrieves a substring of this string. The substring starts from a specific character index, and has a specified length. The new substring has the same allocator as the string.

    Declaration
    public static NativeText Substring(this ref NativeText str, int startIndex, int length)
    Parameters
    Type Name Description
    NativeText str

    A NativeText string to get the substring from.

    int startIndex

    Start index of substring.

    int length

    Length of substring.

    Returns
    Type Description
    NativeText

    A NativeText string that has length equivalent to length and begins at startIndex.

    Exceptions
    Type Condition
    ArgumentOutOfRangeException

    Thrown if startIndex or length parameter is negative, or if startIndex is larger than string length.

    Substring(ref NativeText, int)

    Retrieves a substring of this string. The substring starts from a specific character index and continues to the end of the string. The new substring has the same allocator as the string.

    Declaration
    public static NativeText Substring(this ref NativeText str, int startIndex)
    Parameters
    Type Name Description
    NativeText str

    A NativeText to get the substring from.

    int startIndex

    Start index of substring.

    Returns
    Type Description
    NativeText

    A NativeText string that begins at startIndex.

    In This Article
    Back to top
    Copyright © 2023 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)