I am trying to take a string and replace everything that isn't A-Z with a space. So for example "AB$CD$EF" should output "AB CD EF"
The problem I'm having is the following error:
Instance argument: cannot convert from 'string[]' to 'System.Linq.IQueryable'
Code:
string[] alpha = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
string inVAR = textBox1.Text.ToUpper();
string outVAR;
StringBuilder sb = new StringBuilder(inVAR);
foreach (int i in inVAR) // inVAR because stringbuilders won't work with foreach
{
if (alpha.Contains(sb[i]))
{
outVAR += sb[i].ToString();
}
else
{
sb[i] = ' ';
}
}
Also, if you got a different way of doing an array of A-Z, I am open! :P
For the record: Yes, I have included System.Linq