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
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VLC command 34 82
SQL Server Database Inventory 7 33
How does this modal gets closed? 6 42
How to send the email using C# with embedded HTML TABLE 3 25
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

710 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