|
Question : remove trailing comma from list
|
|
HI
I must be doing something really stupid wrong as my code is not working so I hoped a fresh pair of eyes might see my mistake.
I need to remove the last character from a string. It is basically a trailing comma in a comma separated list. Here is my code but the comma remains!
'remove trailing comma from list s = s.Remove(s.Length - 1, 1)
thanks
|
|
Answer : remove trailing comma from list
|
|
Or you could pass both space AND comma to TrimEnd:
Dim s As String = "a,b,c, " Debug.Print(s) s = s.TrimEnd(" ,".ToCharArray) Debug.Print(s)
(so many variations...so little time...)
|
|
|
|