Another approach that can work much faster than RegEx solution:
Dim s As String = "10,000kg crane,21" Dim result As String = New StringBuilder(s).Replace(",", String.Empty, 0, s.LastIndexOf(","c)).ToString()
The bottom line is that it will replace all occurrences of "," with an empty string between the first character and the index of the last ",".
I completed some of the steps and the proposed RegEx solution 1,000,000 times each; on my laptop, without compiling RegEx, this solution is about seven (7) times faster. If you compile RegEx, it's still about twice as fast.
source share