首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在c#中验证支票号码和MICR号

如何在c#中验证支票号码和MICR号
EN

Stack Overflow用户
提问于 2020-12-04 15:59:03
回答 1查看 240关注 0票数 0

我在认证应用程序上工作,其中用户必须输入银行支票号码MICR号码。我希望提醒用户,当他没有以适当的方式输入它。支票和MICR验证是否有正则表达式?有没有办法做到这一点。

提前谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-12-04 17:32:11

可以应用下面的正则表达式。

代码语言:javascript
复制
        //Make sure the first digit does not start with zero
        string pattern = @"^[1-9][0-9]{8}$"; //if always 9 digits are required
        //pattern = @"^[1-9][0-9]{5,8}$"; //if always 6-9 digits are required
        string inputValue = "560240004";
        if (Regex.IsMatch(inputValue, pattern))
        {
            Debug.Print($"Input text {inputValue} matches.");
        }
        else
        {
            Debug.Print($"Input text {inputValue} does not match.");
        }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65139884

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档