int sum = 0; string inputString = "test"; char[] inputChars = inputString.ToUpper().ToCharArray(); for (int i = 0; i < inputChars.Length; i++) { sum += inputChars[i] - '@'; } Console.WriteLine(sum);
$arr = ['a'=>1,'b'=>2];
$value = 这里是用户的输入
$dump = $arr[$value];