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
sstringString to process.
charschar[]An array of Unicode characters to remove, or null.
trimStartboolWhether to trim leading characters.
trimEndboolWhether 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
sstringString to process.
trimStartboolWhether to trim leading characters.
trimEndboolWhether 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
sstringString to trim.
rulesTrimTextRulesText trimming rules.