Developers/Delphi[델파이] rushmac
[델파이 팁] 주민등록번호 및 사업자등록번호 유효성 검사하는 함수 주민등록번호 및 사업자번호 유효성 체크하는 함수 입니다. 함수 // 13자리 경우 -> 주민등록번호 체크, 10자리 경우 -> 사업자등록번호 체크 function TForm1.CheckIDNo(const aIDNo: String; aNullIsError: Boolean): Boolean; var TempStr: String; Index, LastDigit: Integer; begin Result := False; TempStr := GetOnlyNumber(aIDNo); // 길이가 0일 경우(입력 안한 경우) if Length(TempStr) = 0 then begin // null을 에러 처리 하라면 에러, null을 에러 처리 하지 ..
델파이 팁 : 전화번호에 하이프("-") 넣는법 전화번호에 "-"(하이픈) 넣는 방법 입니다. 소스 uses에 MaskUtils 선언 합니다. function SetTelephone(vStr :String):String; //전화번호에 하이픈넣기 var vTemp :String; begin vTemp := CtoC(vStr,'-',''); case Length(vTemp) of 7 : Result := FormatMaskText('!000-0000;0; ',vTemp); 8 : Result := FormatMaskText('!0000-0000;0; ',vTemp); 9 : Result := FormatMaskText('!00-000-0000;0; ',vTemp); 10 : begin if Copy(vTe..
델파이 팁 : 금액을 한글로 표현하기 금액을 한글로 변환 하는 방법 입니다. 소스내용 //Parameter : P_Value: 금액 P_Type :정 포함여부( 1: 미포함, 0; 포함) function MoneyToHangul(P_Value : Double; P_Type : Word): String; var LST_Value : String; i : Integer; // LWO_Cnt : Integer; LBO_ZeroSkip : Boolean; begin Result := ''; LST_Value := ''; if P_Value > 0 then begin LST_Value := FloatToStr(P_Value); for i := Length(LST_Value) downto 1 do begin LBO..
Delphi Tip - TEdit 에서 숫자만 입력하는 방법 입니다. 소스 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin // '0'~'9': 0~9 숫자 //#3: Ctrl + C //#8: Tab //#13: VK_RETURN //#22: Ctrl + V if not (Key in ['0'..'9', #3, #8, #10, #13, #22]) then Key := #0; end; 마무리 텍스트 박스 입력란에 숫자만 입력 및 관련 특수문자까지 제거 하는 방법 입니다.
Tip - 100원 이하 절사 방법 델파이 중 trunc 메서드 기능으로 100원 이하 절사 방법 내용 입니다. 100원 이하 절사 방법 코딩 내용 procedure TForm1.Button1Click(Sender: TObject); begin cxCurrencyEdit2.Value := trunc(cxCurrencyEdit1.Value/100)*100; //100원 이하 절사 end; 결과보기
Indy Component 들 중 IdHTTP라는 Component 이용하여 웹 통신 IdHTTP는 http프로토콜 제공해주는 7가지 중 GET, POST방식 모두 사용해서 통신하여 구현하고자 하는 프로그램에 맞게 사용 가능합니다. 1. Get 방식 일경우(http, https) pURL --> https://도메인주소.com?name1=value1&name2=value2 pAuthorization --> Authorization : 인증키 //{$region 'Https/ Get방식'}//pURL : 웹주소( https://도메인주소.com?파라미터) //pAuthorization : 인증키(Authorization)function httpsGet(pURL, pAuthorization ..
function GetMACAdress2: string; var NCB: PNCB; Adapter: PAdapterStatus; RetCode: char; I: Integer; Lenum: PlanaEnum; _SystemID: string; begin Result := ''; _SystemID := ''; Getmem(NCB ,sizeof(TNCB)); Fillchar(NCB^ ,Sizeof(TNCB) ,0); Getmem(Lenum ,sizeof(TLanaEnum)); Fillchar(Lenum^ ,Sizeof(TLanaEnum) ,0); Getmem(Adapter ,sizeof(TAdapterStatus)); Fillchar(Adapter^ ,Sizeof(TAdapterStatus) ,0); Len..
Unit에 포함이 안 될 때 유용한 정보 The following table (which is not exhaustive) lists types and functions (but generally not constants) together with the unit required: Type Unit _Stream ADODB_TLB akTop, akLeft, akRight, akBottom Controls AnsiLowerCase SysUtils Application (the variable not a type) Forms Beep SysUtils or Windows (different functions) CGID_EXPLORER ShlObj CN_BASE Controls CoInitialize Activ..
procedure TForm1.FormShow(Sender: TObject); var wDate : TDateTime; y,m,d : word; begin wDate := now; //현재일자 //wDate := StrToDate(FormatMaskText('0000-00-00;0', '20190901')); //특정일자 DecodeDate(wDate,y,m,d); Label1.Caption := formatDateTime('yyyymmdd',wDate); MaskEdit1.text := formatDateTime('yyyymmdd',IncMonth(wdate,1)-d); //월말 MaskEdit2.text := formatDateTime('yyyymmdd',IncMonth(wdate,-1)-d+1); ..