Trimend() issues

Posted on 2013-01-15
Last Modified: 2013-01-15
I am tring to trim an string from a string builder but it is not trimming the character
 StringBuilder sb = new StringBuilder();
            if (emailSent == 1)
                ListViewSelectedItemCollection col = radlvEmp.SelectedItems;

                foreach (ListViewDataItem item in col)
                    sb.Append(Convert.ToString(item.Value) + ", ");
            string s = sb.ToString();
            s = s.ToString().Trim();

Open in new window

the value is still,
Question by:r3nder
  • 3
LVL 22

Expert Comment

ID: 38779865
s = s.TrimEnd(',');
LVL 22

Accepted Solution

p_davis earned 500 total points
ID: 38779866
TrimEnd returns a string, it doesn't directly manipulate the given string.

Author Closing Comment

ID: 38780113
Thanks P_davis
didnt see that
LVL 22

Expert Comment

ID: 38780122
you're welcome.... I've done it many times.

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now