public static string r(string inputStr)
{
string[] key = readKey();
string key1 = key[0];
string key2 = key[1];
if (key1 != "")
{
if ((inputStr == null) | (inputStr == ""))
{
return inputStr;
}
string[] key3 = key1.Replace(",", ",").Split(new char[] { ',' });
for (int i = 0; i < key3.Length; i++)
{
if (key3[i].Length > 0)
{
inputStr = inputStr.Replace(key3[i], key2);
}
}
}
return inputStr;
}
{
string[] key = readKey();
string key1 = key[0];
string key2 = key[1];
if (key1 != "")
{
if ((inputStr == null) | (inputStr == ""))
{
return inputStr;
}
string[] key3 = key1.Replace(",", ",").Split(new char[] { ',' });
for (int i = 0; i < key3.Length; i++)
{
if (key3[i].Length > 0)
{
inputStr = inputStr.Replace(key3[i], key2);
}
}
}
return inputStr;
}
string key1 = key[0]; //被替换的字符 以,分隔
string key2 = key[1]; //替换后的字符 string[] key3 = key1.Split(new char[] { ',',',' });此类替换使用正则效率更高一点