在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
每倒题得选项可能是多选或者单选。 public static string LetterTransformationNum(string answer, int type) { string num = ""; if (type == 1 || type == 2) //(1和2代表单选和多选) { var str = answer; //去答案 str = TrimAllHtmlTag(str).Replace("】", ""); StringBuilder sp = new StringBuilder(); for (int i = 0; i < str.Length; i++) { if (str[i] >= 'A' && str[i] <= 'G') { sp.Append((char)str[i] - 'A'); } else { sp.Append(str[i]); } } object numanswer = sp.ToString(); num = Convert.ToString(numanswer); } num = String.Join(",", (from c in num select c + "").ToArray()); //加, string answerValue = "[" + num + "]"; return answerValue; } 去掉一些特殊得字符正则 public static string TrimAllHtmlTag(string str) { string reg = "<([^>]+?)>"; return Regex.Replace(str, reg, "").Trim(); }
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论