Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My string builder has value

{

tsfjy

sagdjh

gsdj

sdbhjs

grfyda

}

want to remove last emtyspace
before closing bracket

any suggestions
Posted

we can use string.Join for the same results, please refer to blow code sample.

using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;

class Program
{
static void Main()
{
var list = Enumerable.Range(0, 10).Select(n => n.ToString()).ToArray();
string str = string.Join(",", list);
Console.WriteLine(str);
}
}
 
Share this answer
 
hi Try like this, might help you..


C#
string ss = "{ something }";   // { something }
       ss = ss.Replace(" }", "}");  // { something}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900