i have a string type variable like a="a,b,c,d";
I want to remove all commas and get new value for a like abcd
.I tried a.Replace(",","")
but it is not working.I am using c# 3.0
Try this instead
a = a.Replace("," , "");
Edit
Your code is correct as far as using Replace() function goes. What you are missing is that Replace() does not modify the original string, it returns a new (updated) string which you should save.
a.Replace(",", "");
Works for me, your problem lays else where. Also try this:
= String.Concat(a.Split(','));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With