Table of Contents

Class StringExtensions

Namespace
CriusNyx.Util
Assembly
CriusNyxUtil.dll

Extensions for strings.

public static class StringExtensions
Inheritance
StringExtensions
Inherited Members

Methods

Bisect(string, string, string)

Return the string split up before and after the first occurrence of search. If search does not exist in the string then orDefault will be returned as the first element of result.

public static (string before, string after) Bisect(this string source, string search, string orDefault = "")

Parameters

source string
search string
orDefault string

Default value if search is not found. Default to ""

Returns

(string before, string after)

FormatGrid(IEnumerable<IEnumerable<string>>, string, int, bool)

Format a 2 dimensional list of strings into a grid. The outer dimension should be lines, and the inner dimension should be columns in those lines.

public static string FormatGrid(this IEnumerable<IEnumerable<string>> lines, string separator = "", int maxWidth = -1, bool elipsize = true)

Parameters

lines IEnumerable<IEnumerable<string>>
separator string
maxWidth int
elipsize bool

Returns

string

Indent(string, string)

Indent each line in a string by the specified indentation.

public static string Indent(this string source, string indentation)

Parameters

source string
indentation string

Returns

string

StringJoin(IEnumerable<string>, string)

Join an enumerable of strings into a single string.

public static string StringJoin(this IEnumerable<string> source, string separator = "")

Parameters

source IEnumerable<string>
separator string

Returns

string

Truncate(string, int, string)

Truncate the string to the specified length. Elipsize the string with the specified elipsize if provided.

public static string Truncate(this string source, int Length, string elipsize = "")

Parameters

source string
Length int
elipsize string

Returns

string