IBAN: Difference between revisions

→‎Free Pascal: move upCase to entrypoint function, demonstrate strUtils.delSpace function use
(→‎Free Pascal: move upCase to entrypoint function, demonstrate strUtils.delSpace function use)
Line 2,050:
=={{header|Free Pascal}}==
{{libheader|GMP}}
<lang Delphi>{$mode objFPC}
{$mode objFPC}
 
uses
// for delSpace function
strUtils,
// GNU multiple-precision library
GMP;
Line 2,071 ⟶ 2,072:
\return \param sample constains less than the most detectable errors
}
function isLegal(const sample: IBANRepresentation): Boolean;
function checksumCorrect(sample: IBANRepresentation): Boolean;
type
Line 2,091 ⟶ 2,092:
if not (sequence[i] in ['0'..'9']) then
begin
writeStr(transliteration, ord(upCase(sequence[i])) - ord('A') + 10);
end;
Line 2,113 ⟶ 2,114:
end;
begin
sample := upCase(sample);
{$push}
// just for emphasis: by default the FPC performs lazy evaluation
Line 2,126 ⟶ 2,128:
IBANLengthInCountry['G', 'B'] := 22;
// note, strings longer than 34 characters will be silently clipped
writeLn(isLegal('GB82WEST12345698765432'));
writeLn(isLegal(delSpace('GB82 WEST 1234 5698 7654 32')));
end.
end.</lang>
{{out}}
<pre>TRUE</pre>
TRUE
</pre>
 
=={{header|Go}}==
149

edits