Trim last "," delimiter of a string in VB.NET
string, trim, vb.net
Solution
temp = temp.TrimEnd(CChar(","))
That will do it and I think it is the easiest way.
Problem
This is my code: ``` With ad.Tables(2) For i As Integer = 0 To .Rows.Count - 1 If .Rows(i)("name") & "" <> "" Then temp &= .Rows(i)("name") & ", " End If Next End With temp = temp.Trim(",") testing &= "&Name=" & temp & vbCrLf ``` With this is get a comma in the end of the string. But if I do ``` temp = temp.Trim.Trim(",") ``` all commas are deleted. How do I keep all commas and only delete the last one?