주민등록번호 성인인증
function IsUserAudult(jumin : string):boolean;
var
juminleng, lastnum : integer;
yy, mm, dd : string;
nyy, nmm, ndd : integer;
iyy, imm, idd : integer;
ryy, rmm : integer;
isAudult : boolean;
begin
result := false;
nyy := strtoint(Formatdatetime('YYYY', now));
nmm := strtoint(Formatdatetime('MM', now));
ndd := strtoint(Formatdatetime('DD', now));
juminleng := length(jumin);
if juminleng < 6 then
exit
else
if juminleng = 6 then
begin
yy := copy(jumin, 1, 2);
mm := copy(jumin, 3, 2);
dd := copy(jumin, 5, 2);
lastnum := 0;
end
else
if juminleng > 6 then
begin
yy := copy(jumin, 1, 2);
mm := copy(jumin, 3, 2);
dd := copy(jumin, 5, 2);
lastnum := strtoint(copy(jumin, 7, 1));
end;
case lastnum of
0..2 :
begin
iyy := strtoint('19' + yy)
end;
3..4 :
begin
iyy := strtoint('20' + yy)
end;
end;
imm := strtoint(mm);
idd := strtoint(dd);
ryy := nyy - iyy;
if ryy = 20 then
begin
if nmm = imm then
begin
if ndd = idd then
isAudult := true
else
begin
if ndd > idd then
isAudult := false
else
isAudult := true;
end
end
else
begin
if nmm > imm then
isAudult := false
else
isAudult := true;
end;
end
else
if ryy <= 19 then
isAudult := false
else
if ryy >= 21 then
isAudult := true;
result := isAudult;
end;
'Delphi > 프로시저-함수' 카테고리의 다른 글
해당날짜 몇 주차인지 알아내기 (0) | 2024.07.05 |
---|---|
숫자 정수 반올림(어셈블러 Assembler) (0) | 2024.05.28 |
첫번째 영문을 대문자 변경 (0) | 2024.05.13 |
한글 자음 모음 분리 (0) | 2024.05.10 |
HEX 코드를 TColor 값으로 변환하여 반환 (0) | 2024.04.29 |
댓글