델파이 unit, 유닛 :
단위 유닛 1;
인터페이스
용도
창, 메시지, 시스템, 클래스, 그래픽, 컨트롤, 양식, 대화, 대화,
stdctrls;
유형
tform1 = 클래스 (tform)
Listbox1 : tlistbox;
Listbox2 : tlistbox;
edit1 : 테디;
라벨 1 : tlabel;
절차 edit1change (sender : tobject);
절차 양식 쇼 (sender : tobject);
절차 formdestroy (sender : tobject);
절차 edit1enter (sender : tobject);
절차 edit1exit (sender : tobject);
사적인
{개인 선언}
공공의
resultlist1 : tstrings;
끝;
var
form1 : tform1;
절차 searchBypyIndexstr (pyindexstr : String);
구현
{$ r *.dfm}
함수 getPyIndexchar (hzchar : String) : String;
시작하다
case (Word (hzchar [1]) shl 8 + Word (hzchar [2])의
$ b0a1 .. $ b0c4 : 결과 : = 'a';
$ b0c5 .. $ b2c0 : 결과 : = 'b';
$ b2c1 .. $ b4ed : 결과 : = 'c';
$ b4ee .. $ b6e9 : 결과 : = 'd';
$ b6ea .. $ b7a1 : 결과 : = 'e';
$ b7a2 .. $ b8c0 : 결과 : = 'f';
$ b8c1 .. $ b9fd : 결과 : = 'g';
$ b9fe .. $ bbf6 : 결과 : = 'h';
$ bbf7 .. $ bfa5 : 결과 : = 'j';
$ bfa6 .. $ c0ab : 결과 : = 'k';
$ C0AC .. $ C2E7 : 결과 : = 'l';
$ C2E8 .. $ C4C2 : 결과 : = 'M';
$ C4C3 .. $ C5B5 : 결과 : = 'N';
$ C5B6 .. $ C5BD : 결과 : = 'O';
$ c5be .. $ c6d9 : 결과 : = 'p';
$ C6DA .. $ C8BA : 결과 : = 'Q';
$ c8bb .. $ c8f5 : 결과 : = 'r';
$ c8f6 .. $ cbf9 : 결과 : = 's';
$ cbfa .. $ cdd9 : 결과 : = 't';
$ cdda .. $ cef3 : 결과 : = 'w';
$ cef4 .. $ d1b8 : 결과 : = 'x';
$ d1b9 .. $ d4d0 : 결과 : = 'y';
$ d4d1 .. $ d7f9 : 결과 : = 'z';
또 다른
결과 : = char (0);
끝;
끝;
절차 searchBypyIndexstr (pyindexstr : String);
레이블이없는 레이블;
var
I, J : 정수;
hzchar : 문자열;
시작하다
i : = 0 to form1.listbox1.items.count-1 do
시작하다
j : = 1에서 길이 (pyindexstr) do의 경우
시작하다
hzchar : = form1.listbox1.items [i] [2*j-1]+form1.listbox1.items [i] [2*j];
if (pyindexstr [j] <> '?') 및 (대문자 (pyindexstr [j]) <> getpyindexchar (hzchar))
Goto notfound;
끝;
form1.resultlist1.add (form1.listbox1.items [i]);
NotFound :
끝;
끝;
절차 tform1.edit1change (sender : tobject);
시작하다
edit1.text <> ''인 경우
시작하다
listbox2.items.clear;
form1.resultlist1. clear;
SearchBypyIndexstr (edit1.text);
listbox2.items.addstrings (resultList1);
끝;
끝;
절차 tform1.formshow (발신자 : Tobject);
시작하다
resultlist1 : = tstringlist.create;
끝;
절차 tform1.formdestroy (sender : tobject);
시작하다
resultList1.Free;
끝;
절차 tform1.edit1enter (sender : tobject);
시작하다
edit1.text : = '';
끝;
절차 tform1.edit1exit (sender : tobject);
시작하다
edit1.text : = '请输入声母';
끝;
끝.