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