Class StringExtensions
string extension methods.
Inheritance
Inherited Members
Namespace: GlitchedPolygons.ExtensionMethods
Assembly: UnityScriptsLibrary.dll
Syntax
public static class StringExtensions
Methods
| Improve this Doc View SourceIsASCII(String)
Checks whether a given string only contains ASCII characters or not.
null or empty strings return true!.
Declaration
public static bool IsASCII(this string str)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | The string to check. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the checked |
IsValidEmail(String)
Checks if a given string is a valid email address or not.
Declaration
public static bool IsValidEmail(this string str)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | The email address to validate. |
Returns
| Type | Description |
|---|---|
| System.Boolean | Whether the given email address |
MD5(String, Boolean)
Computes the MD5 hash of a string.
Declaration
public static string MD5(this string text, bool toLowercase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to hash. |
| System.Boolean | toLowercase | Should the output hash be lowercased? |
Returns
| Type | Description |
|---|---|
| System.String | MD5 hash of the input string. |
NotNullNotEmpty(String)
Returns true when the passed string is not null or empty; false otherwise.
Declaration
public static bool NotNullNotEmpty(this string str)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | The |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
NullOrEmpty(String)
Returns whether the passed string is null or empty.
Declaration
public static bool NullOrEmpty(this string str)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | str | The |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
OpenUrlInBrowser(String)
Opens the string URL in the browser.
Declaration
public static void OpenUrlInBrowser(this string url)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | url | The URL |
SHA1(String, Boolean)
Computes the SHA1 of a string.
Declaration
public static string SHA1(this string text, bool toLowercase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to hash. |
| System.Boolean | toLowercase | Should the output hash |
Returns
| Type | Description |
|---|---|
| System.String | SHA1 of the input string. |
SHA256(String, Boolean)
Computes the SHA256 of a string.
Declaration
public static string SHA256(this string text, bool toLowercase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to hash. |
| System.Boolean | toLowercase | Should the output hash |
Returns
| Type | Description |
|---|---|
| System.String | SHA256 of the input string. |
SHA384(String, Boolean)
Computes the SHA384 of a string.
Declaration
public static string SHA384(this string text, bool toLowercase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to hash. |
| System.Boolean | toLowercase | Should the output hash |
Returns
| Type | Description |
|---|---|
| System.String | SHA384 of the input string. |
SHA512(String, Boolean)
Computes the SHA512 of a string.
Declaration
public static string SHA512(this string text, bool toLowercase = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to hash. |
| System.Boolean | toLowercase | Should the output hash |
Returns
| Type | Description |
|---|---|
| System.String | SHA512 of the input string. |
ToBytesFromBase64(String)
Converts a base64-encoded System.String to bytes, appending '=' padding characters to it if needed.
Declaration
public static byte[] ToBytesFromBase64(this string b64)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | b64 | The string to convert. |
Returns
| Type | Description |
|---|---|
| System.Byte[] |
|
UTF8GetBytes(String)
Encodes a string to bytes using Encoding.UTF8.
Declaration
public static byte[] UTF8GetBytes(this string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The text to encode. |
Returns
| Type | Description |
|---|---|
| System.Byte[] | The encoded |