Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,49 @@
|
|||
EnableExplicit
|
||||
|
||||
Procedure.b Check_ISIN(*c.Character)
|
||||
Define count.i=0, Idx.i=1, v.i=0, i.i
|
||||
Dim s.i(24)
|
||||
|
||||
If MemoryStringLength(*c) > 12 : ProcedureReturn #False : EndIf
|
||||
|
||||
While *c\c
|
||||
count+1
|
||||
If *c\c>='0' And *c\c<='9'
|
||||
If count<=2 : ProcedureReturn #False : EndIf
|
||||
s(Idx)= *c\c - '0'
|
||||
Idx+1
|
||||
ElseIf *c\c>='A' And *c\c<='Z'
|
||||
s(Idx)= (*c\c - ('A'-10)) / 10
|
||||
Idx+1
|
||||
s(Idx)= (*c\c - ('A'-10)) % 10
|
||||
Idx+1
|
||||
Else
|
||||
ProcedureReturn #False
|
||||
EndIf
|
||||
*c + SizeOf(Character)
|
||||
Wend
|
||||
|
||||
For i=Idx-2 To 0 Step -2
|
||||
If s(i)*2 > 9
|
||||
v+ s(i)*2 -9
|
||||
Else
|
||||
v+ s(i)*2
|
||||
EndIf
|
||||
v+s(i+1)
|
||||
Next
|
||||
|
||||
ProcedureReturn Bool(v%10=0)
|
||||
EndProcedure
|
||||
|
||||
Define.s s
|
||||
OpenConsole("Validate_International_Securities_Identification_Number (ISIN)")
|
||||
|
||||
If ReadFile(0,"c:\code_pb\rosettacode\data\isin.txt")
|
||||
While Not Eof(0)
|
||||
s=ReadString(0)
|
||||
Print(s+~"\t")
|
||||
If Check_ISIN(@s) : PrintN("TRUE") : Else : PrintN("FALSE") : EndIf
|
||||
Wend
|
||||
CloseFile(0)
|
||||
EndIf
|
||||
Input()
|
||||
Loading…
Add table
Add a link
Reference in a new issue