Hi,
I want to remove the invalid or illegal character form a string in c#, kindly help me out
Thank you,
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Mukesh KumarRank #119 · 18.2K reputationPosted Nov 8, 2015, 9:50 PM EST
regular expressionsin C#.Using regular expressions with C#:using System.Text.RegularExpressions; string your_String = "Hello@Hello&Hello(Hello)"; string my_String = Regex.Replace(your_String, @"[^0-9a-zA-Z]+", ",");{ if ((c >= '0' && c '9') || (c >= 'A' && c 'Z') || (c >= 'a' && c 'z') || c == '.' || c == '_')Nishant MittalRank #692 · 3.5K reputationPosted Nov 8, 2015, 7:51 PM EST
praveen kumar185 reputationPosted Nov 8, 2015, 8:24 PM EST
FileInfo[] infos = d.GetFiles();
foreach (FileInfo f in infos)
File.Move(f.FullName, Path.Combine(f.DirectoryName, "N " + label3.Text + "-" + label4.Text + " " + "9187" + " " + "0000" + " " + "00" + " " + textBox5.Text + textBox2.Text + " " + ".doc"));
// System.IO.File.Move(textBox3.Text,path);
MessageBox.Show("Done");
}