Class StringExtensions
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
Returns
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
linesIEnumerable<IEnumerable<string>>separatorstringmaxWidthintelipsizebool
Returns
Indent(string, string)
Indent each line in a string by the specified indentation.
public static string Indent(this string source, string indentation)
Parameters
Returns
StringJoin(IEnumerable<string>, string)
Join an enumerable of strings into a single string.
public static string StringJoin(this IEnumerable<string> source, string separator = "")
Parameters
sourceIEnumerable<string>separatorstring
Returns
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 = "")