using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Lab5_Assignment_1
{
class Program
{
static void Main(string[] args)
{
string a = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string b="DEFGHIJKLMNOPQRSTUVWXYZABC";
Console.Write("Enter your string:");
string text = Console.ReadLine();
text = text.ToUpper();
Console.WriteLine("Input Text = " + text);
Console.Write("output text = ");
foreach(char i in text)
{
int pos=a.IndexOf(i);
if(i>='A' && i<='Z')
{
Console.Write(b[pos]);
}
else
{
Console.Write(i);
}
}
Console.ReadKey();
}
}
}
如何从输入文本和输出中删除非字母数字字符,例如我输入hello world!在我的字符串中,我希望它在输入中显示为HELLOWORLD,输出中的KHOORZROUG使用子字符串删除那些字符,任何人都可以帮助我吗?