Talk:ISO 7064
From Free Pascal wiki
Jump to navigationJump to search
Not stable code
Because of 'isx := StrToInt( sx );', the code fails on any non-digit string. It's bad. Alextp (talk) 19:32, 28 November 2021 (CET)
- Most likely it is supposed to fail if any of the chars is NOT a digit. Having it fail with an exception is not worse than having it fail in some other way (e.g. setting resukt to -MaxInt, having an out paramter indicating succes or do it like the many TryStrtoYYY conversion routines we have), as long as that behaviour is documented.--Bart (talk) 23:39, 28 November 2021 (CET)
@Alextp. IMO the page is a bit useless now after your last edits. --Bart (talk) 21:34, 2 December 2021 (CET)
- You might as well delete this page considering it was essentially only referenced by the IBAN page (cf. Special: WhatLinksHere/ISO 7064). I mean, it’s unlikely anyone’s looking for exactly this page in this wiki. If its content were expanded significantly, I’d keep it though. Kai Burghardt (talk) 23:58, 2 December 2021 (CET)
- In the absence of any further inout from Alextp, I have restored and enhanced the content. As to links other than to the IBAN example, I'll see what I can do later. Trev (talk) 07:50, 4 December 2021 (CET)
How to pass or get two check-characters?
"The function StrMOD97 can encode and verify a check character (an added character which may be used to verify the accuracy of the string by a mathematical relationship to that string) and a supplementary check character" -- I dont see how the function (returns Integer) can get 2 CHARACTERS. --Alextp (talk) 20:32, 4 December 2021 (CET)
- For the two check digits to be correct when using the MOD 97-10 function, the remainder after calculating the modulus 97 must be 1 which is why the function returns a single integer. Trev (talk) 02:13, 6 December 2021 (CET)
- Still not clear... if the text talks about '2 characters' then function must handle / return 2 chars. But it's not the case.. Alextp (talk) 15:10, 6 December 2021 (CET)
- That's not the way that the MOD 97-10 algorithm works - there's no reason why it must return two characters, it returns one and if that is not 1, the check has failed. Just like OS errors - if 0 is not returned, the function failed. There is no reason why it must return anything other than success or failure. Trev (talk) 00:05, 8 December 2021 (CET)
- Still not clear... if the text talks about '2 characters' then function must handle / return 2 chars. But it's not the case.. Alextp (talk) 15:10, 6 December 2021 (CET)