I've got string "55, 55,55, 55, "
and I want to replace last two characters (comma and white space) to nothing using only the method .Replace()
. The example below clear all commas but I want to clear only two last ones. In Java you write:
variable.replaceAll(", $",""); // it's correct effect two last characters are changed to nothing
Replace(", ","") // but in c# you get: 55555,5555 and Replace(", $","") doesn't work
How to write it properly to get this effect using only Replace
method?