Articles   Members Online: 3
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to check if a social security number is valid ?? Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
05-Nov-02
Category
Algorithm
Language
Delphi 3.x
Views
143
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Ronald Buster

How to check if a social security number is valid ??

note : only tested on the dutch social security numbers

Answer:
1   
2   function CheckFiscaalNumber(Value: string): boolean;
3   var
4     n1, n2, n3, n4, n5, n6, n7, n8, n9: integer;
5     s1, s2, s3, s4, s5, s6, s7, s8: integer;
6     totaal, rest: integer;
7   begin
8     if StrToInt(Value) > 10000000 then
9     begin
10      if Length(Value) >= 8 then
11      begin
12  
13        if Length(Value) = 8 then
14        begin
15          Value := '0' + Value;
16        end;
17  
18        n1 := StrToInt(copy(Value, 1, 1));
19        n2 := StrToInt(copy(Value, 2, 1));
20        n3 := StrToInt(copy(Value, 3, 1));
21        n4 := StrToInt(copy(Value, 4, 1));
22        n5 := StrToInt(copy(Value, 5, 1));
23        n6 := StrToInt(copy(Value, 6, 1));
24        n7 := StrToInt(copy(Value, 7, 1));
25        n8 := StrToInt(copy(Value, 8, 1));
26        n9 := StrToInt(copy(Value, 9, 1));
27  
28        s1 := n1 * 9;
29        s2 := n2 * 8;
30        s3 := n3 * 7;
31        s4 := n4 * 6;
32        s5 := n5 * 5;
33        s6 := n6 * 4;
34        s7 := n7 * 3;
35        s8 := n8 * 2;
36  
37        totaal := s1 + s2 + s3 + s4 + s5 + s6 + s7 + s8;
38        rest := totaal mod 11;
39  
40        if rest <> n9 then
41        begin
42          Result := False;
43        end
44        else
45        begin
46          Result := True;
47        end;
48      end
49      else
50      begin
51        Result := False;
52      end;
53  
54    end
55    else
56    begin
57      Result := False;
58    end;
59  
60  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC