Class StringExtensions
Extension methods for System.String.
Inherited Members
Namespace: Unity.Tutorials.Core.Editor
Assembly: Unity.Tutorials.Core.Editor.dll
Syntax
public static class StringExtensions
Methods
AsEmptyIfNull(string)
Returns an empty string ("") if this string is null.
Declaration
public static string AsEmptyIfNull(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
string | An empty string if the string is null |
AsNullIfEmpty(string)
Returns null if this string is null or an empty string ("").
Declaration
public static string AsNullIfEmpty(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
string | null if the string is empty, the unmodified string otherwise |
AsNullIfWhiteSpace(string)
Returns null if this string is not null, empty, or consists only of white-space characters.
Declaration
public static string AsNullIfWhiteSpace(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
string | null if the string is only whitespace, the unmodified string otherwise |
IsNotNullOrEmpty(string)
Indicates whether this string is not null or an empty string ("").
Declaration
public static bool IsNotNullOrEmpty(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
bool | True if not null or empty |
IsNotNullOrWhiteSpace(string)
Indicates whether this string is not null, empty, or consists only of white-space characters.
Declaration
public static bool IsNotNullOrWhiteSpace(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
bool | True if not empty or only whitespace |
IsNullOrEmpty(string)
Indicates whether this string is null or an empty string ("").
Declaration
public static bool IsNullOrEmpty(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
bool | True if null or empty |
IsNullOrWhiteSpace(string)
Indicates whether this string is null, empty, or consists only of white-space characters.
Declaration
public static bool IsNullOrWhiteSpace(this string self)
Parameters
Type | Name | Description |
---|---|---|
string | self | The string this function acts on |
Returns
Type | Description |
---|---|
bool | True if null or whitespace only |