docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class StringExtensions

    This class contains extension methods for the string class.

    Inheritance
    object
    StringExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: UnityEngine.TestTools.Graphics
    Assembly: UnityEngine.TestTools.Graphics.dll
    Syntax
    public static class StringExtensions

    Methods

    FromUrlSafeBase64(string)

    Converts a URL-safe Base64 string to a regular Base64 string.

    Declaration
    public static string FromUrlSafeBase64(this string value)
    Parameters
    Type Name Description
    string value

    The URL-safe Base64 string to convert to a regular Base64 string.

    Returns
    Type Description
    string

    The regular Base64 string.

    SanitizeBackslashes(string)

    Replaces backslashes with forward slashes in the given string

    Declaration
    public static string SanitizeBackslashes(this string value)
    Parameters
    Type Name Description
    string value

    The string to sanitize

    Returns
    Type Description
    string

    The string with backslashes replaced with forward slashes

    ToUrlSafeBase64(string)

    Converts a string to a URL-safe Base64 string.

    Declaration
    public static string ToUrlSafeBase64(this string value)
    Parameters
    Type Name Description
    string value

    The string to convert to a URL-safe Base64 string.

    Returns
    Type Description
    string

    The URL-safe Base64 string.

    ToValidPath(string)

    Replaces invalid characters in a string to make it a valid path.

    Declaration
    public static string ToValidPath(this string value)
    Parameters
    Type Name Description
    string value

    The string to make a valid path.

    Returns
    Type Description
    string

    A valid path string.

    Remarks

    Replacement rules are intentionally asymmetric to produce readable, filesystem-safe paths:

    • ( is replaced with _ (preserves word boundary)
    • ) is removed entirely (closing paren adds no value)
    • " is removed entirely
    • , is replaced with - (preserves visual separator)
    In This Article
    Back to top
    Copyright © 2026 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)