string trim end bug - by Reynaldo Ferrer

Status : 

  By Design<br /><br />
		The product team believes this item works according to its intended design.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


2
2
Sign in
to vote
ID 776234 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/10/2013 5:26:38 AM
Access Restriction Public

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"
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)