简体   繁体   中英

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. The problem is that I'm still very new to objective-c and I don't know anything about javascript...

Here is the javascript code:

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...

Any kind soul to give me some guidance I would be very thankful.

str2bigInt() is not a javascript built-in function. Therefore it doesn't make part of your code and that's why you get undefined error for it. Javascript stops after that error.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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