docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Class StringExtensions

    Set of utility functions with string

    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: UnityEditor.Rendering
    Assembly: Unity.RenderPipelines.Core.Editor.dll
    Syntax
    public static class StringExtensions

    Methods

    ContainsAny(string, params string[])

    Checks if a string contains any of the strings given in strings to check and early out if it does

    Declaration
    public static bool ContainsAny(this string input, params string[] stringsToCheck)
    Parameters
    Type Name Description
    string input

    The input string

    string[] stringsToCheck

    List of strings to check

    Returns
    Type Description
    bool

    True if the input contains any of the strings from stringsToCheck; otherwise, false.

    HasExtension(string, string)

    Checks if the given string ends with the given extension

    Declaration
    public static bool HasExtension(this string input, string extension)
    Parameters
    Type Name Description
    string input

    The input string

    string extension

    The extension

    Returns
    Type Description
    bool

    True if the extension is found on the string path

    ReplaceInvalidFileNameCharacters(string, string)

    Replaces invalid characters for a filename or a directory with a given optional replacemenet string

    Declaration
    public static string ReplaceInvalidFileNameCharacters(this string input, string replacement = "_")
    Parameters
    Type Name Description
    string input

    The input filename or directory

    string replacement

    The replacement

    Returns
    Type Description
    string

    The string with the invalid characters replaced

    In This Article
    Back to top
    Copyright © 2024 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)