110,499
社区成员
发帖
与我相关
我的任务
分享
string intput = "Hello 字!";
input = Encoding.ASCII.GetString(Encoding.ASCII.GetBytes(s)); // input = Hello ?!
private void button1_Click(object sender, EventArgs e)
{
string A = "a好B了";
string LAST = "";
for (int i = 0; i < A.Length; i++)
{
string B = A.Substring(i, 1);
Match m = Regex.Match(B, @"^[A-Z,a-z]*$");
if (!m.Success)
{
LAST = LAST + "?";
}
else
{
LAST = LAST + B;
}
}
MessageBox.Show(LAST);
}
Regex reg = new Regex(@"[\u4E00-\u9FFF]");
string str = "测试testing测试aaaaaaaaaaaa";
string res = reg.Replace(str, "?");
Console.WriteLine(res);