reckfellENGINE

StringExtensions

Extension methods to manipulate strings.

On this page
class StringExtensionsReckfellSharp

Extension methods to manipulate strings.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Methods79

Bigramsstring[]
# Bigrams
C#
public static string[] Bigrams(this string instance);

Returns the bigrams (pairs of consecutive letters) of this string.

Parameters
NameTypeDefault
instancestring—
instance

The string that will be used.

Returns string[]

The bigrams of this string.

BinToIntint
# BinToInt
C#
public static int BinToInt(this string instance);

Converts a string containing a binary number into an integer. Binary strings can either be prefixed with 0b or not, and they can also start with a - before the optional prefix.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns int

The converted string.

CEscapestring
# CEscape
C#
public static string CEscape(this string instance);

Returns a copy of the string with special characters escaped using the C language standard.

Parameters
NameTypeDefault
instancestring—
instance

The string to escape.

Returns string

The escaped string.

CUnescapestring
# CUnescape
C#
public static string CUnescape(this string instance);

Returns a copy of the string with escaped characters replaced by their meanings according to the C language standard.

Parameters
NameTypeDefault
instancestring—
instance

The string to unescape.

Returns string

The unescaped string.

Capitalizestring
# Capitalize
C#
public static string Capitalize(this string instance);

Changes the case of some letters. Replace underscores with spaces, convert all letters to lowercase then capitalize first and every letter following the space character. For capitalize camelCase mixed_with_underscores it will return Capitalize Camelcase Mixed With Underscores.

Parameters
NameTypeDefault
instancestring—
instance

The string to capitalize.

Returns string

The capitalized string.

CasecmpToint
# CasecmpTo
C#
public static int CasecmpTo(this string instance, string to);

Performs a case-sensitive comparison to another string and returns an integer that indicates their relative position in the sort order.

Parameters
NameTypeDefault
instancestring—
tostring—
instance

The string to compare.

to

The other string to compare.

Returns int

An integer that indicates the lexical relationship between the two comparands.

CompareToint · Deprecated
# CompareTo
C#
public static int CompareTo(this string instance, string to, bool caseSensitive = true);

Performs a comparison to another string and returns an integer that indicates their relative position in the sort order.

Parameters
NameTypeDefault
instancestring—
tostring—
caseSensitivebooltrue
instance

The string to compare.

to

The other string to compare.

caseSensitive

If true, the comparison will be case sensitive.

Returns int

An integer that indicates the lexical relationship between the two comparands.

Countint
# Count
C#
public static int Count(this string instance, string what, int from = 0, int to = 0, bool caseSensitive = true);

Returns the number of occurrences of substring what in the string.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint0
toint0
caseSensitivebooltrue
instance

The string where the substring will be searched.

what

The substring that will be counted.

from

Index to start searching from.

to

Index to stop searching at.

caseSensitive

If the search is case sensitive.

Returns int

Number of occurrences of the substring in the string.

CountNint
# CountN
C#
public static int CountN(this string instance, string what, int from = 0, int to = 0);

Returns the number of occurrences of substring what (ignoring case) between PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To positions. If PhysicsRayQueryParameters2D.From and PhysicsRayQueryParameters2D.To equals 0 the whole string will be used. If only PhysicsRayQueryParameters2D.To equals 0 the remained substring will be used.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint0
toint0
instance

The string where the substring will be searched.

what

The substring that will be counted.

from

Index to start searching from.

to

Index to stop searching at.

Returns int

Number of occurrences of the substring in the string.

Dedentstring
# Dedent
C#
public static string Dedent(this string instance);

Returns a copy of the string with indentation (leading tabs and spaces) removed. See also StringExtensions.Indent to add indentation.

Parameters
NameTypeDefault
instancestring—
instance

The string to remove the indentation from.

Returns string

The string with the indentation removed.

Find2 overloads
# Find · 1/2
C#
public static int Find(this string instance, char what, int from = 0, bool caseSensitive = true);

Find the first occurrence of a char. Optionally, the search starting position can be passed.

Parameters
NameTypeDefault
instancestring—
whatchar—
fromint0
caseSensitivebooltrue
instance

The string that will be searched.

what

The substring to find.

from

The search starting position.

caseSensitive

If true, the search is case sensitive.

Returns int

The first instance of the char, or -1 if not found.

# Find · 2/2
C#
public static int Find(this string instance, string what, int from = 0, bool caseSensitive = true);

Returns the index of the first occurrence of the specified string in this instance, or -1. Optionally, the starting search index can be specified, continuing to the end of the string. Note: If you just want to know whether a string contains a substring, use the System.String.Contains(System.String) method.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint0
caseSensitivebooltrue
instance

The string that will be searched.

what

The substring to find.

from

The search starting position.

caseSensitive

If true, the search is case sensitive.

Returns int

The starting position of the substring, or -1 if not found.

FindNint
# FindN
C#
public static int FindN(this string instance, string what, int from = 0);

Returns the index of the first case-insensitive occurrence of the specified string in this instance, or -1. Optionally, the starting search index can be specified, continuing to the end of the string.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint0
instance

The string that will be searched.

what

The substring to find.

from

The search starting position.

Returns int

The starting position of the substring, or -1 if not found.

GetBaseDirstring
# GetBaseDir
C#
public static string GetBaseDir(this string instance);

If the string is a path to a file, return the base directory.

Parameters
NameTypeDefault
instancestring—
instance

The path to a file.

Returns string

The base directory.

GetBaseNamestring
# GetBaseName
C#
public static string GetBaseName(this string instance);

If the string is a path to a file, return the path to the file without the extension.

Parameters
NameTypeDefault
instancestring—
instance

The path to a file.

Returns string

The path to the file without the extension.

GetExtensionstring
# GetExtension
C#
public static string GetExtension(this string instance);

Returns the extension without the leading period character (.) if the string is a valid file name or path. If the string does not contain an extension, returns an empty string instead.

Parameters
NameTypeDefault
instancestring—
instance

The path to a file.

Returns string

The extension of the file or an empty string.

GetFilestring
# GetFile
C#
public static string GetFile(this string instance);

If the string is a path to a file, return the file and ignore the base directory.

Parameters
NameTypeDefault
instancestring—
instance

The path to a file.

Returns string

The file name.

GetStringFromAsciistring
# GetStringFromAscii
C#
public static string GetStringFromAscii(this byte[] bytes);

Converts ASCII encoded array to string. Fast alternative to StringExtensions.GetStringFromUtf8 if the content is ASCII-only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use StringExtensions.GetStringFromUtf8.

Parameters
NameTypeDefault
bytesbyte[]—
bytes

A byte array of ASCII characters (on the range of 0-127).

Returns string

A string created from the bytes.

GetStringFromUtf16string
# GetStringFromUtf16
C#
public static string GetStringFromUtf16(this byte[] bytes);

Converts UTF-16 encoded array to string using the little endian byte order.

Parameters
NameTypeDefault
bytesbyte[]—
bytes

A byte array of UTF-16 characters.

Returns string

A string created from the bytes.

GetStringFromUtf32string
# GetStringFromUtf32
C#
public static string GetStringFromUtf32(this byte[] bytes);

Converts UTF-32 encoded array to string using the little endian byte order.

Parameters
NameTypeDefault
bytesbyte[]—
bytes

A byte array of UTF-32 characters.

Returns string

A string created from the bytes.

GetStringFromUtf8string
# GetStringFromUtf8
C#
public static string GetStringFromUtf8(this byte[] bytes);

Converts UTF-8 encoded array to string. Slower than StringExtensions.GetStringFromAscii but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred.

Parameters
NameTypeDefault
bytesbyte[]—
bytes

A byte array of UTF-8 characters (a character may take up multiple bytes).

Returns string

A string created from the bytes.

Hashuint
# Hash
C#
public static uint Hash(this string instance);

Hash the string and return a 32 bits unsigned integer.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns uint

The calculated hash of the string.

HexDecodebyte[]
# HexDecode
C#
public static byte[] HexDecode(this string instance);

Decodes a hexadecimal string.

Parameters
NameTypeDefault
instancestring—
instance

The hexadecimal string.

Returns byte[]

The byte array representation of this string.

HexEncodestring
# HexEncode
C#
public static string HexEncode(this byte[] bytes);

Returns a hexadecimal representation of this byte array as a string.

Parameters
NameTypeDefault
bytesbyte[]—
bytes

The byte array to encode.

Returns string

The hexadecimal representation of this byte array.

HexToIntint
# HexToInt
C#
public static int HexToInt(this string instance);

Converts a string containing a hexadecimal number into an integer. Hexadecimal strings can either be prefixed with 0x or not, and they can also start with a - before the optional prefix.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns int

The converted string.

Indentstring
# Indent
C#
public static string Indent(this string instance, string prefix);

Returns a copy of the string with lines indented with SpinBox.Prefix. For example, the string can be indented with two tabs using "\t\t", or four spaces using " ". The prefix can be any string so it can also be used to comment out strings with e.g. "//. See also StringExtensions.Dedent to remove indentation. Note: Empty lines are kept empty.

Parameters
NameTypeDefault
instancestring—
prefixstring—
instance

The string to add indentation to.

prefix

The string to use as indentation.

Returns string

The string with indentation added.

IsAbsolutePathbool
# IsAbsolutePath
C#
public static bool IsAbsolutePath(this string instance);

Returns true if the string is a path to a file or directory and its starting point is explicitly defined. This includes asset://, user://, C:\, /, etc.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string is an absolute path.

IsRelativePathbool
# IsRelativePath
C#
public static bool IsRelativePath(this string instance);

Returns true if the string is a path to a file or directory and its starting point is implicitly defined within the context it is being used. The starting point may refer to the current directory (./), or the current Entity.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string is a relative path.

IsSubsequenceOfbool
# IsSubsequenceOf
C#
public static bool IsSubsequenceOf(this string instance, string text, bool caseSensitive = true);

Check whether this string is a subsequence of the given string.

Parameters
NameTypeDefault
instancestring—
textstring—
caseSensitivebooltrue
instance

The subsequence to search.

text

The string that contains the subsequence.

caseSensitive

If true, the check is case sensitive.

Returns bool

If the string is a subsequence of the given string.

IsSubsequenceOfNbool
# IsSubsequenceOfN
C#
public static bool IsSubsequenceOfN(this string instance, string text);

Check whether this string is a subsequence of the given string, ignoring case differences.

Parameters
NameTypeDefault
instancestring—
textstring—
instance

The subsequence to search.

text

The string that contains the subsequence.

Returns bool

If the string is a subsequence of the given string.

IsValidFileNamebool
# IsValidFileName
C#
public static bool IsValidFileName(this string instance);

Returns true if this string is free from characters that aren't allowed in file names.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid file name.

IsValidFloatbool
# IsValidFloat
C#
public static bool IsValidFloat(this string instance);

Returns true if this string contains a valid float. This is inclusive of integers, and also supports exponents.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid floating point number.

IsValidHexNumberbool
# IsValidHexNumber
C#
public static bool IsValidHexNumber(this string instance, bool withPrefix = false);

Returns true if this string contains a valid hexadecimal number. If withPrefix is true, then a validity of the hexadecimal number is determined by 0x prefix, for instance: 0xDEADC0DE.

Parameters
NameTypeDefault
instancestring—
withPrefixboolfalse
instance

The string to check.

withPrefix

If the string must contain the 0x prefix to be valid.

Returns bool

If the string contains a valid hexadecimal number.

IsValidHtmlColorbool
# IsValidHtmlColor
C#
public static bool IsValidHtmlColor(this string instance);

Returns true if this string contains a valid color in hexadecimal HTML notation. Other HTML notations such as named colors or hsl() aren't considered valid by this method and will return false.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid HTML color.

IsValidIPAddressbool
# IsValidIPAddress
C#
public static bool IsValidIPAddress(this string instance);

Returns true if this string contains only a well-formatted IPv4 or IPv6 address. This method considers reserved IP addresses such as 0.0.0.0 as valid.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid IP address.

IsValidIdentifierbool
# IsValidIdentifier
C#
public static bool IsValidIdentifier(this string instance);

Returns true if this string is a valid identifier. A valid identifier may contain only letters, digits and underscores (_) and the first character may not be a digit.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid identifier.

IsValidIntbool
# IsValidInt
C#
public static bool IsValidInt(this string instance);

Returns true if this string contains a valid int.

Parameters
NameTypeDefault
instancestring—
instance

The string to check.

Returns bool

If the string contains a valid integer.

JSONEscapestring
# JSONEscape
C#
public static string JSONEscape(this string instance);

Returns a copy of the string with special characters escaped using the JSON standard.

Parameters
NameTypeDefault
instancestring—
instance

The string to escape.

Returns string

The escaped string.

Leftstring
# Left
C#
public static string Left(this string instance, int pos);

Returns an amount of characters from the left of the string.

Parameters
NameTypeDefault
instancestring—
posint—
instance

The original string.

pos

The position in the string where the left side ends.

Returns string

The left side of the string from the given position.

Matchbool
# Match
C#
public static bool Match(this string instance, string expr, bool caseSensitive = true);

Do a simple case sensitive expression match, using ? and * wildcards.

Parameters
NameTypeDefault
instancestring—
exprstring—
caseSensitivebooltrue
instance

The string to check.

expr

Expression to check.

caseSensitive

If true, the check will be case sensitive.

Returns bool

If the expression has any matches.

MatchNbool
# MatchN
C#
public static bool MatchN(this string instance, string expr);

Do a simple case insensitive expression match, using ? and * wildcards.

Parameters
NameTypeDefault
instancestring—
exprstring—
instance

The string to check.

expr

Expression to check.

Returns bool

If the expression has any matches.

Md5Bufferbyte[]
# Md5Buffer
C#
public static byte[] Md5Buffer(this string instance);

Returns the MD5 hash of the string as an array of bytes.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns byte[]

The MD5 hash of the string.

Md5Textstring
# Md5Text
C#
public static string Md5Text(this string instance);

Returns the MD5 hash of the string as a string.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns string

The MD5 hash of the string.

NocasecmpToint
# NocasecmpTo
C#
public static int NocasecmpTo(this string instance, string to);

Performs a case-insensitive comparison to another string and returns an integer that indicates their relative position in the sort order.

Parameters
NameTypeDefault
instancestring—
tostring—
instance

The string to compare.

to

The other string to compare.

Returns int

An integer that indicates the lexical relationship between the two comparands.

PadDecimalsstring
# PadDecimals
C#
public static string PadDecimals(this string instance, int digits);

Format a number to have an exact number of digits after the decimal point.

Parameters
NameTypeDefault
instancestring—
digitsint—
instance

The string to pad.

digits

Amount of digits after the decimal point.

Returns string

The string padded with zeroes.

PadZerosstring
# PadZeros
C#
public static string PadZeros(this string instance, int digits);

Format a number to have an exact number of digits before the decimal point.

Parameters
NameTypeDefault
instancestring—
digitsint—
instance

The string to pad.

digits

Amount of digits before the decimal point.

Returns string

The string padded with zeroes.

PathJoinstring
# PathJoin
C#
public static string PathJoin(this string instance, string file);

If the string is a path, this concatenates VideoStream.File at the end of the string as a subpath. E.g. "this/is".PathJoin("path") == "this/is/path".

Parameters
NameTypeDefault
instancestring—
filestring—
instance

The path that will be concatenated.

file

File name to concatenate with the path.

Returns string

The concatenated path with the given file name.

RFindint
# RFind
C#
public static int RFind(this string instance, string what, int from = -1, bool caseSensitive = true);

Returns the index of the last occurrence of the specified string in this instance, or -1. Optionally, the starting search index can be specified, continuing to the beginning of the string.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint-1
caseSensitivebooltrue
instance

The string that will be searched.

what

The substring to search in the string.

from

The position at which to start searching.

caseSensitive

If true, the search is case sensitive.

Returns int

The position at which the substring was found, or -1 if not found.

RFindNint
# RFindN
C#
public static int RFindN(this string instance, string what, int from = -1);

Returns the index of the last case-insensitive occurrence of the specified string in this instance, or -1. Optionally, the starting search index can be specified, continuing to the beginning of the string.

Parameters
NameTypeDefault
instancestring—
whatstring—
fromint-1
instance

The string that will be searched.

what

The substring to search in the string.

from

The position at which to start searching.

Returns int

The position at which the substring was found, or -1 if not found.

ReplaceNstring
# ReplaceN
C#
public static string ReplaceN(this string instance, string what, string forwhat);

Replace occurrences of a substring for different ones inside the string, but search case-insensitive.

Parameters
NameTypeDefault
instancestring—
whatstring—
forwhatstring—
instance

The string to modify.

what

The substring to be replaced in the string.

forwhat

The substring that replaces what.

Returns string

The string with the substring occurrences replaced.

Rightstring
# Right
C#
public static string Right(this string instance, int pos);

Returns the right side of the string from a given position.

Parameters
NameTypeDefault
instancestring—
posint—
instance

The original string.

pos

The position in the string from which the right side starts.

Returns string

The right side of the string from the given position.

Sha1Bufferbyte[]
# Sha1Buffer
C#
public static byte[] Sha1Buffer(this string instance);

Returns the SHA-1 hash of the string as an array of bytes.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns byte[]

The SHA-1 hash of the string.

Sha1Textstring
# Sha1Text
C#
public static string Sha1Text(this string instance);

Returns the SHA-1 hash of the string as a string.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns string

The SHA-1 hash of the string.

Sha256Bufferbyte[]
# Sha256Buffer
C#
public static byte[] Sha256Buffer(this string instance);

Returns the SHA-256 hash of the string as an array of bytes.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns byte[]

The SHA-256 hash of the string.

Sha256Textstring
# Sha256Text
C#
public static string Sha256Text(this string instance);

Returns the SHA-256 hash of the string as a string.

Parameters
NameTypeDefault
instancestring—
instance

The string to hash.

Returns string

The SHA-256 hash of the string.

Similarityfloat
# Similarity
C#
public static float Similarity(this string instance, string text);

Returns the similarity index of the text compared to this string. 1 means totally similar and 0 means totally dissimilar.

Parameters
NameTypeDefault
instancestring—
textstring—
instance

The string to compare.

text

The other string to compare.

Returns float

The similarity index.

SimplifyPathstring
# SimplifyPath
C#
public static string SimplifyPath(this string instance);

Returns a simplified canonical path.

Parameters
NameTypeDefault
instancestring—
Returns string
Splitstring[]
# Split
C#
public static string[] Split(this string instance, string divisor, bool allowEmpty = true);

Split the string by a divisor string, return an array of the substrings. Example "One,Two,Three" will return ["One","Two","Three"] if split by ",".

Parameters
NameTypeDefault
instancestring—
divisorstring—
allowEmptybooltrue
instance

The string to split.

divisor

The divisor string that splits the string.

allowEmpty

If true, the array may include empty strings.

Returns string[]

The array of strings split from the string.

SplitFloatsfloat[]
# SplitFloats
C#
public static float[] SplitFloats(this string instance, string divisor, bool allowEmpty = true);

Split the string in floats by using a divisor string, return an array of the substrings. Example "1,2.5,3" will return [1,2.5,3] if split by ",".

Parameters
NameTypeDefault
instancestring—
divisorstring—
allowEmptybooltrue
instance

The string to split.

divisor

The divisor string that splits the string.

allowEmpty

If true, the array may include empty floats.

Returns float[]

The array of floats split from the string.

StripEdgesstring
# StripEdges
C#
public static string StripEdges(this string instance, bool left = true, bool right = true);

Returns a copy of the string stripped of any non-printable character (including tabulations, spaces and line breaks) at the beginning and the end. The optional arguments are used to toggle stripping on the left and right edges respectively.

Parameters
NameTypeDefault
instancestring—
leftbooltrue
rightbooltrue
instance

The string to strip.

left

If the left side should be stripped.

right

If the right side should be stripped.

Returns string

The string stripped of any non-printable characters.

StripEscapesstring
# StripEscapes
C#
public static string StripEscapes(this string instance);

Returns a copy of the string stripped of any escape character. These include all non-printable control characters of the first page of the ASCII table (< 32), such as tabulation (\t) and newline (\n and \r) characters, but not spaces.

Parameters
NameTypeDefault
instancestring—
instance

The string to strip.

Returns string

The string stripped of any escape characters.

Substrstring
# Substr
C#
public static string Substr(this string instance, int from, int len);

Returns part of the string from the position PhysicsRayQueryParameters2D.From, with length len.

Parameters
NameTypeDefault
instancestring—
fromint—
lenint—
instance

The string to slice.

from

The position in the string that the part starts from.

len

The length of the returned part.

Returns string

Part of the string from the position PhysicsRayQueryParameters2D.From, with length len.

ToAsciiBufferbyte[]
# ToAsciiBuffer
C#
public static byte[] ToAsciiBuffer(this string instance);

Converts the String (which is a character array) to PackedByteArray (which is an array of bytes). The conversion is faster compared to StringExtensions.ToUtf8Buffer, as this method assumes that all the characters in the String are ASCII characters.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns byte[]

The string as ASCII encoded bytes.

ToCamelCasestring
# ToCamelCase
C#
public static string ToCamelCase(this string instance);

Returns the string converted to camelCase.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns string

The converted string.

ToFloatfloat
# ToFloat
C#
public static float ToFloat(this string instance);

Converts a string, containing a decimal number, into a float.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns float

The number representation of the string.

ToIntint
# ToInt
C#
public static int ToInt(this string instance);

Converts a string, containing an integer number, into an int.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns int

The number representation of the string.

ToKebabCasestring
# ToKebabCase
C#
public static string ToKebabCase(this string instance);

Returns the string converted to kebab-case.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns string

The converted string.

ToPascalCasestring
# ToPascalCase
C#
public static string ToPascalCase(this string instance);

Returns the string converted to PascalCase.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns string

The converted string.

ToSnakeCasestring
# ToSnakeCase
C#
public static string ToSnakeCase(this string instance);

Returns the string converted to snake_case.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns string

The converted string.

ToUtf16Bufferbyte[]
# ToUtf16Buffer
C#
public static byte[] ToUtf16Buffer(this string instance);

Converts the string (which is an array of characters) to a UTF-16 encoded array of bytes.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns byte[]

The string as UTF-16 encoded bytes.

ToUtf32Bufferbyte[]
# ToUtf32Buffer
C#
public static byte[] ToUtf32Buffer(this string instance);

Converts the string (which is an array of characters) to a UTF-32 encoded array of bytes.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns byte[]

The string as UTF-32 encoded bytes.

ToUtf8Bufferbyte[]
# ToUtf8Buffer
C#
public static byte[] ToUtf8Buffer(this string instance);

Converts the string (which is an array of characters) to a UTF-8 encoded array of bytes. The conversion is a bit slower than StringExtensions.ToAsciiBuffer, but supports all UTF-8 characters. Therefore, you should prefer this function over StringExtensions.ToAsciiBuffer.

Parameters
NameTypeDefault
instancestring—
instance

The string to convert.

Returns byte[]

The string as UTF-8 encoded bytes.

TrimPrefixstring
# TrimPrefix
C#
public static string TrimPrefix(this string instance, string prefix);

Removes a given string from the start if it starts with it or leaves the string unchanged.

Parameters
NameTypeDefault
instancestring—
prefixstring—
instance

The string to remove the prefix from.

prefix

The string to remove from the start.

Returns string

A copy of the string with the prefix string removed from the start.

TrimSuffixstring
# TrimSuffix
C#
public static string TrimSuffix(this string instance, string suffix);

Removes a given string from the end if it ends with it or leaves the string unchanged.

Parameters
NameTypeDefault
instancestring—
suffixstring—
instance

The string to remove the suffix from.

suffix

The string to remove from the end.

Returns string

A copy of the string with the suffix string removed from the end.

URIDecodestring
# URIDecode
C#
public static string URIDecode(this string instance);

Decodes a string in URL encoded format. This is meant to decode parameters in a URL when receiving an HTTP request. This mostly wraps around System.Uri.UnescapeDataString(System.String), but also handles +. See StringExtensions.URIEncode for encoding.

Parameters
NameTypeDefault
instancestring—
instance

The string to decode.

Returns string

The unescaped string.

URIEncodestring
# URIEncode
C#
public static string URIEncode(this string instance);

Encodes a string to URL friendly format. This is meant to encode parameters in a URL when sending an HTTP request. This wraps around System.Uri.EscapeDataString(System.String). See StringExtensions.URIDecode for decoding.

Parameters
NameTypeDefault
instancestring—
instance

The string to encode.

Returns string

The escaped string.

ValidateNodeNamestring
# ValidateNodeName
C#
public static string ValidateNodeName(this string instance);

Removes any characters from the string that are prohibited in Entity names (. : @ / ").

Parameters
NameTypeDefault
instancestring—
instance

The string to sanitize.

Returns string

The string sanitized as a valid node name.

XMLEscapestring
# XMLEscape
C#
public static string XMLEscape(this string instance);

Returns a copy of the string with special characters escaped using the XML standard.

Parameters
NameTypeDefault
instancestring—
instance

The string to escape.

Returns string

The escaped string.

XMLUnescapestring
# XMLUnescape
C#
public static string? XMLUnescape(this string instance);

Returns a copy of the string with escaped characters replaced by their meanings according to the XML standard.

Parameters
NameTypeDefault
instancestring—
instance

The string to unescape.

Returns string

The unescaped string.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.