Class SHJoin
- Namespace
- SunamoStringJoin
- Assembly
- SunamoStringJoin.dll
String helper methods for joining strings and collections with delimiters.
public class SHJoin
- Inheritance
-
SHJoin
- Inherited Members
- Extension Methods
Methods
IsNumber(string, string, bool)
Checks whether the input text represents a number.
public static bool IsNumber(string text, string mustContain, bool isInverting)
Parameters
textstringThe text to check.
mustContainstringRequired content parameter used by delegate signature.
isInvertingboolWhether to invert the result.
Returns
Join(object, params string[])
Joins string parts with a delimiter object.
public static string Join(object delimiter, params string[] array)
Parameters
Returns
Join(string, List<string>)
Joins a list of strings with a delimiter.
public static string Join(string delimiter, List<string> list)
Parameters
delimiterstringThe delimiter to place between parts.
listList<string>The list of strings to join.
Returns
- string
The joined string.
JoinArray(object, params string[])
Joins string parts with a delimiter, validates correct argument order.
public static string JoinArray(object delimiter, params string[] array)
Parameters
Returns
JoinChars(params char[])
Joins characters into a single string.
public static string JoinChars(params char[] characters)
Parameters
characterschar[]The characters to join.
Returns
JoinComma(params string[])
Joins string arguments with a comma delimiter.
public static string JoinComma(params string[] array)
Parameters
arraystring[]The string arguments to join.
Returns
JoinDictionary(Dictionary<string, string>, string)
Joins a dictionary into a string with each entry on a new line.
public static string JoinDictionary(Dictionary<string, string> dictionary, string delimiter)
Parameters
dictionaryDictionary<string, string>The dictionary to join.
delimiterstringThe delimiter between key and value on each line.
Returns
JoinDictionary(IDictionary<string, string>, string, string)
Joins a dictionary into a string with specified delimiters between and after key-value pairs.
public static string JoinDictionary(IDictionary<string, string> dictionary, string delimiterBetweenKeyAndValue, string delimiterAfter)
Parameters
dictionaryIDictionary<string, string>The dictionary to join.
delimiterBetweenKeyAndValuestringThe delimiter between each key and value.
delimiterAfterstringThe delimiter after each key-value pair.
Returns
JoinFromIndex(int, object, IList)
Joins list elements from a specified start index with a delimiter, trimming the last delimiter character.
public static string JoinFromIndex(int startIndex, object delimiter, IList list)
Parameters
startIndexintThe index to start joining from.
delimiterobjectThe delimiter object.
listIListThe list of parts to join.
Returns
JoinKeyValueCollection(IList, IList, string, string)
Joins two parallel lists as key-value pairs with specified delimiters.
public static string JoinKeyValueCollection(IList keys, IList values, string delimiterBetweenKeyAndValue, string delimiterAfter)
Parameters
keysIListThe list of keys.
valuesIListThe list of values.
delimiterBetweenKeyAndValuestringThe delimiter between each key and value.
delimiterAfterstringThe delimiter after each key-value pair.
Returns
JoinMoreWords(object, params string[])
Joins words, wrapping non-number elements with quotes.
public static string JoinMoreWords(object delimiter, params string[] array)
Parameters
Returns
JoinNL(List<string>, bool)
Joins a list of strings with newline characters.
public static string JoinNL(List<string> list, bool isRemovingLastNewline = false)
Parameters
listList<string>The list of strings to join.
isRemovingLastNewlineboolWhether to remove the trailing newline.
Returns
- string
The joined string.
JoinNLSb(StringBuilder, List<string>)
Joins a list of strings with newlines using a StringBuilder.
public static string JoinNLSb(StringBuilder stringBuilder, List<string> list)
Parameters
stringBuilderStringBuilderThe StringBuilder to use for joining.
listList<string>The list of strings to join.
Returns
JoinSentences(bool, params string[])
Joins sentences, ensuring each ends with a period.
public static string JoinSentences(bool isAddingAfterLast, params string[] array)
Parameters
isAddingAfterLastboolWhether to keep the period after the last sentence.
arraystring[]The sentences to join.
Returns
JoinSpace(List<string>)
Joins a list of strings with a space delimiter.
public static string JoinSpace(List<string> list)
Parameters
Returns
JoinString(object, List<string>)
Joins a list of strings with a delimiter. Wrapper for Join(string, List<string>).
public static string JoinString(object delimiter, List<string> list)
Parameters
Returns
JoinString(string, List<string>)
Joins a list of strings with a delimiter. Wrapper for Join(string, List<string>).
public static string JoinString(string delimiter, List<string> list)
Parameters
delimiterstringThe delimiter to place between parts.
listList<string>The list of strings to join.
Returns
JoinStringExceptIndexes(object, IList, params int[])
Joins list elements with a delimiter, excluding elements at specified indexes.
public static string JoinStringExceptIndexes(object delimiter, IList list, params int[] excludedIndexes)
Parameters
delimiterobjectThe delimiter object.
listIListThe list of parts to join.
excludedIndexesint[]The indexes to exclude from joining.
Returns
JoinStringParams(object, params string[])
Joins string parts with a delimiter. Wrapper for Join(object, params string[]).
public static string JoinStringParams(object delimiter, params string[] array)
Parameters
Returns
JoinTimes(int, string)
Repeats a text a specified number of times.
public static string JoinTimes(int times, string text)
Parameters
Returns
JoinToIndex(int, object, IList)
Joins list elements up to a specified end index (exclusive) with a delimiter.
public static string JoinToIndex(int endIndex, object delimiter, IList list)
Parameters
endIndexintThe exclusive end index.
delimiterobjectThe delimiter object.
listIListThe list of parts to join.
Returns
JoinWithoutEndTrimDelimiter(object, params string[])
Joins string parts with a delimiter without trimming the end delimiter.
public static string JoinWithoutEndTrimDelimiter(object delimiter, params string[] array)
Parameters
Returns
JoinWithoutTrim(object, IList)
Joins list elements with a delimiter without trimming the end.
public static string JoinWithoutTrim(object delimiter, IList list)