using System;
namespace Demo {
class myApplication {
static void Main(string[] args) {
string str = "Amit$#%";
char[] one = str.ToCharArray();
char[] two = new char[one.Length];
int c = 0;
for (int i = 0; i < one.Length; i++) {
if (!Char.IsLetterOrDigit(one[i])) {
two[c] = one[i];
c++;
}
}
Array.Resize(ref two, c);
Console.WriteLine("Following are the special characters:");
foreach(var items in two) {
Console.WriteLine(items);
}
Console.ReadLine();
}
}
}
原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/265908.html