我的代码是这样的:
string dex = "ABCD1234";
string ch = "C";
string ch1, ch2;
if (dex.Contains(ch))
{
string n = Convert.ToChar(dex);
MessageBox.Show(ch + " is on " + n + " place and is between " + ch1 + " and " + ch2);
}
Run Code Online (Sandbox Code Playgroud)
我想将字符串转换为数组,但我做不到,也无法检索“ ch”字符串的位置及其之间的位置。
输出应为:
MessageBox.Show("C is on 3rd place and is between B and D");
Run Code Online (Sandbox Code Playgroud)