Kiwimoisi Kiwimoisi - 2 months ago 8x
C# Question

Delete last char of string

I am retrieving a lot of informations in a list, linked to a Database .

I want to create a string of groups, for someone who is connected to the website.

I use this to test ... But this is not dynamic so really bad :

string strgroupids = "6";

I want to use this now . But the string returned is something like 1,2,3,4,5,

//groupIds.ForEach((g) =>
// strgroupids = strgroupids + g.ToString() + ",";
// strgroupids.TrimEnd(',');

//strgroupids.TrimEnd(new char[] { ',' });

I want to delete the , after the 5 but it's definitely not working ..
Can someone help me?

Thank you very much.

sll sll
strgroupids = strgroupids.Remove(strgroupids.Length - 1);



Deletes all the characters from this string beginning at a specified position and continuing through the last position