Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
可以控制字符串 Number 是否有 9 位数字?
String Number; if() { //9 digits }
你有什么想法吗?谢谢。
if (Regex.IsMatch(Number,@"\d{9}")) { //Has 9 digits }
string Number; if (Regex.Match(number, "\d{9}")) { // Number has 9 digits } if (Regex.Match(number, "^\d{9}$")) { // Number is 9 digits only }