I try to replace few characters in some string 14/04/2010 17:12:11
and get, for example, next result:
14%04%2010%17%12%11
I know about method Replace
, but its definition looks like Replace(Char,Char)
. Which means using it 3 times in method chain. Doesn't look idiomatic. How to solve the problem in an optimal way? Regular expressions? Any ways to escape them?
Chain it:
string s1 = "14/04/2010 17:12:1";
string s2 = s1.Replace("/","%").Replace(" ","%").Replace(":","%");
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