Alex Rivera | Logout

Remove characters from C# string

Asked 2011-09-14T04:58:19.103
206

How might I remove characters from a string? For example: "My name @is ,Wan.;'; Wan".

I would like to remove the characters '@', ',', '.', ';', '\'' from that string so that it becomes "My name is Wan Wan"

Edit
Report

1 Answer

18
 string x = "My name @is ,Wan.;'; Wan";
 string modifiedString = x.Replace("@", "").Replace(",", "").Replace(".", "").Replace(";", "").Replace("'", "");
answered 2013-05-02T23:32:07.940

Your Answer