您好,这样:
// str 为 需要进行转换的字符串.
public static string ConvertCode(string str)
{
System.Text.StringBuilder strBuilder=new System.Text.StringBuilder();
foreach(char ch in str)
{
if((ch>=65 && ch<=90) || (ch>=97 && ch<=122))
{ //+3 才会是 a --> d b -->e
strBuilder.Append(Convert.ToChar(Convert.ToInt32(ch)+3).ToString());
}
else
{
strBuilder.Append(ch.ToString());
}
}
return strBuilder.ToString();
}