Table of Contents

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

commandLine string

The string to extract from.

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

input string

The input.

symbol char

The symbol.

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

firstString string

The first string to be compared.

secondString string

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

userId string

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

userId string

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

name string

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

input string

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

input string

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

str string

The string to be converted.

shouldReplaceSpecialChars bool

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

enumerable IEnumerable<T>

The instance.

showIndex bool

Indicates whether the enumerator index should be shown.

Returns

string

Returns the converted IEnumerable<T>.

Type Parameters

T

The type of the IEnumerable.