trim last "," delimiter of a string in vb.net
- by gerfe
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 this
temp = temp.Trim.Trim(",")
all commas are deleted.
How do i keep all commas and only delete the last one?