Class StringExtensions
A set of extensions for System.String.
Inheritance
Inherited Members
Namespace: Exiled.API.Extensions
Assembly: Exiled.API.dll
Syntax
public static class StringExtensions
Methods
| Improve this Doc View SourceExtractCommand(String)
Extract command name and arguments from a System.String.
Declaration
public static (string commandName, string[] arguments) ExtractCommand(this string commandLine)
Parameters
Type | Name | Description |
---|---|---|
System.String | commandLine | The System.String to extract from. |
Returns
Type | Description |
---|---|
System.ValueTuple<System.String, System.String[]> | Returns a System.ValueTuple containing the exctracted command name and arguments. |
GetBefore(String, Char)
Retrieves a string before a symbol from an input.
Declaration
public static string GetBefore(this string input, char symbol)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | The input. |
System.Char | symbol | The symbol. |
Returns
Type | Description |
---|---|
System.String | Substring before the symbol. |
GetDistance(String, String)
Compute the distance between two System.String.
Declaration
public static int GetDistance(this string firstString, string secondString)
Parameters
Type | Name | Description |
---|---|---|
System.String | firstString | The first string to be compared. |
System.String | secondString | The second string to be compared. |
Returns
Type | Description |
---|---|
System.Int32 | Returns the distance between the two strings. |
GetHashedUserId(String)
Gets a SHA256 hash of a player's user id without the authentication.
Declaration
public static string GetHashedUserId(this string userId)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | The user id. |
Returns
Type | Description |
---|---|
System.String | The hashed userid. |
GetRawUserId(String)
Gets the player's user id without the authentication.
Declaration
public static string GetRawUserId(this string userId)
Parameters
Type | Name | Description |
---|---|---|
System.String | userId | The user id. |
Returns
Type | Description |
---|---|
System.String | Returns the raw user id. |
RemoveBracketsOnEndOfName(String)
Removes the prefab-generated brackets (#) on UnityEngine.GameObject names.
Declaration
public static string RemoveBracketsOnEndOfName(this string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | Name of the UnityEngine.GameObject. |
Returns
Type | Description |
---|---|
System.String | Name without brackets. |
RemoveSpaces(String)
Removes all space symbols from string.
Declaration
public static string RemoveSpaces(this string input)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | Input string. |
Returns
Type | Description |
---|---|
System.String | String without spaces. |
SplitCamelCase(String)
Splits camel case string to space-separated words. Ex: SomeCamelCase -> Some Camel Case.
Declaration
public static string SplitCamelCase(this string input)
Parameters
Type | Name | Description |
---|---|---|
System.String | input | Camel case string. |
Returns
Type | Description |
---|---|
System.String | Splitted string. |
ToSnakeCase(String, Boolean)
Converts a System.String to snake_case convention.
Declaration
public static string ToSnakeCase(this string str, bool shouldReplaceSpecialChars = true)
Parameters
Type | Name | Description |
---|---|---|
System.String | str | The string to be converted. |
System.Boolean | shouldReplaceSpecialChars | Indicates whether special chars has to be replaced or not. |
Returns
Type | Description |
---|---|
System.String | Returns the new snake_case string. |
ToString<T>(IEnumerable<T>, Boolean)
Converts an System.Collections.Generic.IEnumerable<T> into a string.
Declaration
public static string ToString<T>(this IEnumerable<T> enumerable, bool showIndex = true)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<T> | enumerable | The instance. |
System.Boolean | showIndex | Indicates whether the enumerator index should be shown or not. |
Returns
Type | Description |
---|---|
System.String | Returns the converted System.Collections.Generic.IEnumerable<T>. |
Type Parameters
Name | Description |
---|---|
T | The type of the IEnumerable. |