Method Trim
Trim(string?, char[], bool, bool)
Removes all leading and trailing occurrences of a set of characters specified
in an array from the string. trimStart
and trimEnd
parameters specify whether to remove leading and trailing occurrences.
public static string? Trim(string? s, char[] chars, bool trimStart = true, bool trimEnd = true)
Parameters
s
stringString to process.
chars
char[]An array of Unicode characters to remove, or null.
trimStart
boolWhether to trim leading characters.
trimEnd
boolWhether to trim trailing characters.
Returns
Trim(string?, bool, bool)
Removes all leading and trailing white-space characters from the string.
trimStart
and trimEnd
parameters specify whether to remove leading and trailing occurrences.
public static string? Trim(string? s, bool trimStart = true, bool trimEnd = true)
Parameters
s
stringString to process.
trimStart
boolWhether to trim leading characters.
trimEnd
boolWhether to trim trailing characters.
Returns
Trim(string?, TrimTextRules)
Trims the string using the specified text trimming rules.
public static string? Trim(string? s, TrimTextRules rules)
Parameters
s
stringString to trim.
rules
TrimTextRulesText trimming rules.