StringPolyfillExtensionTrim(String, String) Method

Generates a String from which all leading and trailing occurrences of the characters in the specified read-only span are removed.

Definition

Namespace: FolkerKinzel.Strings
Assembly: FolkerKinzel.Strings (in FolkerKinzel.Strings.dll) Version: 9.4.0+10a7d4d71aa960998e32ac0ac6c4fcbe4164c917
C#
public static string Trim(
	this string s,
	string? trimChars
)

Parameters

s  String
The String to change.
trimChars  String
A String that contains the Unicode characters to remove or null. If trimChars is null or an empty string, Unicode white-space characters are removed instead.

Return Value

String
The resulting String after removing all characters passed in the trimChars parameter from the beginning and end of the String.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type String. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

Exceptions

See Also