Closed
Description
Background and motivation
I propose to add the following overloads for the Trim, TrimEnd, and TrimStart methods. The ones that currently work only with the char type."
https://learn.microsoft.com/en/dotnet/api/system.string.trim?view=net-8.0
https://learn.microsoft.com/en-us/dotnet/api/system.string.trimend?view=net-8.0
https://learn.microsoft.com/en-us/dotnet/api/system.string.trimstart?view=net-8.0
API Proposal
class Example
{
public string Trim(string trimText)
=> throw new NotSupportedException();
public string TrimStart(string trimText)
=> throw new NotSupportedException();
public string TrimEnd(string trimText)
=> throw new NotSupportedException();
}
API Usage
string text = "__32__".Trim("__");//Result:32
string textBegin = "__32__".TrimStart("__");//Result:32__
string textEnd = "__32__".TrimEnd("__");//Result:__32
Alternative Designs
No response
Risks
No response