程序代码:
class program
{
public static void Main(string[] args)
{
string str = aa("Hello3?#@Xyz89");
Console.WriteLine(str);
Console.ReadKey();
}
public static string aa(string str)
{
char[] arrChar = str.ToCharArray();
for (int i = 0; i < arrChar.Length; i++)
{
if (65 <= arrChar[i] && arrChar[i] <= 90)
{
int j = arrChar[i] + 2;
if (j > 90)
{
j -= 26;
}
arrChar[i] = (char)j;
}
else if (97 <= arrChar[i] && arrChar[i] <= 122)
{
int k = arrChar[i] + 2;
if (k > 122)
{
k -= 26;
}
arrChar[i] = (char)k;
}
else if (48 <= arrChar[i] && arrChar[i] <= 57)
{
int n = arrChar[i] + 3;
if (n > 57)
{
n -= 10;
}
arrChar[i] = (char)n;
}
}
return new string(arrChar);
}
}