简体   繁体   English

将银行识别码转换为帐号

[英]Transform bank identification number into account number

I have a problem, I need to translate a peace of javascript code (that transforms the bank identification number to account number) into objective-c. 我有一个问题,我需要将javascript代码(将银行识别号转换为帐号)转换为Objective-C。 The problem is that I'm still very new to objective-c and I don't know anything about javascript... 问题是我对Objective-C还是很陌生,我对javascript一无所知...

Here is the javascript code: 这是JavaScript代码:

if (banco == "CGD"){
banco_num=str2bigInt('0035',10,6,21);
NIB_aux=mult(banco_num,str2bigInt('100000000000000000',10,6,21));
str_conta_banco = document.conta_banco.conta.value;

if(isNaN(str_conta_banco) || str_conta_banco.length!=13){
    alert("Invalid account number");
    return;
}
var conta_num = str2bigInt(str_conta_banco,10,6,21);

var conta_sem_balcao = mod(conta_num,str2bigInt('1000000000',10,6,21)); 
var balcao = sub(conta_num,conta_sem_balcao);

conta_sem_balcao = mult(conta_sem_balcao,str2bigInt('100',10,6,21));
balcao = mult(balcao,str2bigInt('10000',10,6,21));

NIB_aux=add(NIB_aux,add(balcao,conta_sem_balcao));

NIB_ref=sub(str2bigInt('98',10,6,21),mod(NIB_aux,str2bigInt('97',10,6,21)));

NIB=add(NIB_aux,NIB_ref);  
NIB_str="00"+bigInt2str(NIB,10);

document.write("<center>O seu NIB &eacute;: "+NIB_str+"<br></br></center>");
return;

} }

I have made some attempts but after 3 hours I gave up...can't figure out the "str2bigInt", "isNaN" etc... 我做了一些尝试,但是3个小时后我放弃了……无法弄清楚“ str2bigInt”,“ isNaN”等...

Any kind soul to give me some guidance I would be very thankful. 任何愿意给我一些指导的人,我将非常感激。

str2bigInt() is not a javascript built-in function. str2bigInt()不是javascript内置函数。 Therefore it doesn't make part of your code and that's why you get undefined error for it. 因此,它不会成为代码的一部分,这就是为什么会收到未定义错误的原因。 Javascript stops after that error. 该错误结束后,Javascript将停止。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM