Home Dashboard Directory Help
Search

string trim end bug by Reynaldo Ferrer


Status: 

Closed
 as By Design Help for as By Design


2
2
Sign in
to vote
Type: Bug
ID: 776234
Opened: 1/10/2013 5:26:38 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

Check this sequence used on immediate window:

"cebola.legal".TrimEnd(".legal".ToCharArray())
"cebo"
"cebola.legal".TrimEnd("legal".ToCharArray())
"cebola."
"cebola.legal".TrimEnd("\.legal".ToCharArray())
Unrecognized escape sequence
"cebola.legal".TrimEnd("..legal".ToCharArray())
"cebo"
"cebola.legal".TrimEnd("........legal".ToCharArray())
"cebo"
"cebola.legal".TrimEnd("........legalp".ToCharArray())
"cebo"
"cebola.legal".TrimEnd("........legalpato".ToCharArray())
"ceb"
Details
Sign in to post a comment.
Posted by Microsoft on 2/11/2013 at 12:10 PM
Hi Reynaldo Ferrer,

That's by-design. The trim APIs will remove any characters that passed via the char array -- order doesn't matter. You use String.Replace() if it doesn't matter where the string occurs. For most precise control you also use System.Text.Regex.

Regards,
Immo Landwerth
.NET Framework Team
Posted by Microsoft on 1/10/2013 at 9:00 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 1/10/2013 at 5:50 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.