Class StringExtensions
Set of utility functions with string
Inherited Members
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 |