Show / Hide Table of Contents

Class StringExtensions

string extension methods.

Inheritance
System.Object
StringExtensions
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: GlitchedPolygons.ExtensionMethods
Assembly: UnityScriptsLibrary.dll
Syntax
public static class StringExtensions

Methods

| Improve this Doc View Source

IsASCII(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 string only contained ASCII chars or not. If the string was empty or null, true is returned.

| Improve this Doc View Source

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 string is valid or not.

| Improve this Doc View Source

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.

| Improve this Doc View Source

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 string to check.

Returns
Type Description
System.Boolean

!string.IsNullOrEmpty(str)

| Improve this Doc View Source

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 string to check.

Returns
Type Description
System.Boolean

string.IsNullOrEmpty(str)

| Improve this Doc View Source

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 string to open.

| Improve this Doc View Source

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 string be lowercased?.

Returns
Type Description
System.String

SHA1 of the input string.

| Improve this Doc View Source

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 string be lowercased?.

Returns
Type Description
System.String

SHA256 of the input string.

| Improve this Doc View Source

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 string be lowercased?.

Returns
Type Description
System.String

SHA384 of the input string.

| Improve this Doc View Source

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 string be lowercased?.

Returns
Type Description
System.String

SHA512 of the input string.

| Improve this Doc View Source

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[]

Convert.FromBase64String(b64)

| Improve this Doc View Source

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 byte[] array.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX