[不是问题] java中的iban验证 [英] [Not a question] iban validation in java

查看:97
本文介绍了[不是问题] java中的iban验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在寻找一种使用以下算法验证比利时iban号码的java方法:

- 检查总IBAN长度为16.如果不是,IBAN无效

-将四个初始字符移动到字符串的末尾

用两位数替换字符串中的每个字母,从而扩展字符串,其中A = 10,B = 11,...,Z = 35

-将字符串解释为十进制整数,并计算除以97的剩余部分

- 如果余数为1,则通过校验位测试并且IBAN可能有效。



也应该进行一些常规检查,因为字符串有效,仅包含字母和数字,没有特殊字符..等等



请帮忙。



谢谢

问候

Hi,
I was looking for a java method to validate belgian iban number using the following algorithm:
-Check that the total IBAN length is 16. If not, the IBAN is invalid
-Move the four initial characters to the end of the string
Replace each letter in the string with two digits, thereby expanding the string, where A = 10, B = 11, ..., Z = 35
-Interpret the string as a decimal integer and compute the remainder of that number on division by 97
-If the remainder is 1, the check digit test is passed and the IBAN might be valid.

also there should be some general checks as the string is valid, only contains letters and digits and no special characters.. etc

Kindly help.

Thanks
Regards

推荐答案

大多数语言中都有很多IBAN验证器 - 假设您引用的算法为m了解IBAN的国际规则(我没有检查)。



这是一个java示例 https://gist.github.com/DandyDev/5394643 [ ^ ]



如果它不能满足您的所有要求,那么您应该能够添加它,或者找到另一个例子通过谷歌
There are lots and lots of IBAN validators out there in most languages - assuming the algorithm you've quoted matches the international rules for IBANs (I didn't check).

Here is one java example https://gist.github.com/DandyDev/5394643[^]

If it doesn't cover all of your requirements then you should be able to add to it, or find another example via Google


这篇关于[不是问题] java中的iban验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆