string plate="粤BN1223"; if (plate.Contains("粤BN")) { //除掉前三个字符,剩下的4个字符全为数字方为特殊车辆 bool BNum = true; char[] strSubCCode = new char[4]; if (plate.Length == 7) { plate.CopyTo(3, strSubCCode, 0, 4); foreach (char c in strSubCCode) { if (!Char.IsNumber(c)) { BNum = false; break; } } if (BNum) { Print.Log("特殊车辆:" + plate+ ",免费放行"); } } }
原文地址:https://www.cnblogs.com/Warmsunshine/p/9409837.html
时间: 2024-10-11 03:34:34