Herhangi bir ev veya iş adresini mahalle, cadde, sokak, vb. gibi ayrı ayrı parsellemek istiyorum. Burada sıkıntı şu kişi kapı numarasını veya posta kodunu cümle içinde farklı yerlere yazabilir. Fikri olan arkadaşlarım yardımcı olabilirse sevinirim.
Şimdilik örnek yazdığım proje aşağıdaki gibidir.
unit1.pas
Kod: Tümünü seç
unit Unit1;
interface
uses
StrUtils, Winapi.Windows, Winapi.Messages, SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, RzEdit, RzButton,
RzBtnEdt, Vcl.Mask, RzLabel, Vcl.Menus, Vcl.Grids, RzGrids;
type
TForm1 = class(TForm)
AdresCoz: TRzButton;
RzMemo1: TRzMemo;
RzMemo2: TRzMemo;
AdresListesi: TRzStringGrid;
AdresSiralamasi: TListBox;
ParcalanmisKelimeler: TRzMemo;
procedure AdresCozClick(Sender: TObject);
Function CumleParcala(Cumle: String; Ayirici: Char): Boolean;
procedure RzButton1Click(Sender: TObject); // split
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
Function IcindeVarmi(Aranan, Metin: String): Integer;
begin
Result := AnsiPos(Aranan, Metin);
end;
Function TForm1.CumleParcala(Cumle: String; Ayirici: Char): Boolean; // split
begin
try
Result := False;
ParcalanmisKelimeler.Clear;
ExtractStrings([Ayirici], [], PWideChar(Cumle), ParcalanmisKelimeler.Lines);
Result := True;
except
Result := False;
end;
end;
procedure TForm1.AdresCozClick(Sender: TObject);
var
beskarakter:Integer;
a, J,I, t:Integer;
s, s1, s2, Mah, Cad, Sok, Kap, Sit, Blo, Dai, Ilc, Seh, Ulk:String;
AdresBilgisi:String;
Mahalle, Cadde, Sokak, KapiNo, SiteAdi, BlokAdi, Daire, Ilce, Sehir, Ulke:Integer;
Function DegerCoz(tip, Deger:String):String;
begin
If Trim(Deger)='' Then Exit;
Form1.CumleParcala(Deger,' ');
If tip='sutun' Then Result:=Trim(Form1.ParcalanmisKelimeler.Lines.Strings[0]);
If tip='nesne' Then Result:=Trim(Form1.ParcalanmisKelimeler.Lines.Strings[1]);
end;
begin
Mahalle:=0; Cadde:=0; Sokak:=0; KapiNo:=0; SiteAdi:=0; BlokAdi:=0; Daire:=0; Ilce:=0; Sehir:=0; Ulke:=0;
RzMemo2.Text:=RzMemo1.Text;
//RzMemo1.Text:='aaa Mah. bbb Cad. ccc Sok. ddd Plaza eee Blok No: 61/A D:4 34940 Tuzla İstanbul';
//RzMemo1.Text:='bbb Cad. ccc Sok. ddd Plaza eee Blok No: 61/A D:4 34940 Tuzla İstanbul';
//RzMemo1.Text:='aaa Mah. ccc Sok. ddd Plaza eee Blok No: 61/A D:4 34940 Tuzla İstanbul';
//RzMemo1.Text:='aaa Mahallesi bbb Caddesi ccc Sokak ddd Sitesi eee Blok No: 61/A D:4 34940 Tuzla İstanbul';
//RzMemo1.Text:='bbb Cad. ccc Sok. aaa Mah. eee Blok ddd Sitesi No: 61/A D:4 34940 Tuzla İstanbul';
RzMemo1.Text:='bbb Cad. ccc Sok. aaa Mah. No: 61/A eee Blok ddd Sitesi D:4 34940 Tuzla İstanbul';
//RzMemo1.Text:='bbb Cad. ccc Sok. aaa Mah. No: 61/A 34940 eee Blok ddd Sitesi D:4 Tuzla İstanbul';
//RzMemo1.Text:='bbb Cad. ccc Sok. eee Blok ddd Sitesi D:4 aaa Mah. No: 61/A 34940 Tuzla İstanbul';
{$REGION ' AdresBilgisi '}
AdresBilgisi:='';
For I:=0 To RzMemo1.Lines.Count-1 do
If Trim(RzMemo1.Lines.Strings[I])<>'' Then
AdresBilgisi:=AdresBilgisi+' '+Trim(RzMemo1.Lines.Strings[I]);
AdresBilgisi:=Trim(AdresBilgisi);
AdresBilgisi:=AdresBilgisi.ToLower;
{$ENDREGION}
{$REGION ' bul '}
If (Mahalle=0 )and(IcindeVarmi('mahallesi',AdresBilgisi)>0) Then begin {ShowMessage('1');} Mahalle:=IcindeVarmi('mahallesi', AdresBilgisi)+9 ; end else
If (Mahalle=0 )and(IcindeVarmi('mahalle',AdresBilgisi)>0) Then begin {ShowMessage('2');} Mahalle:=IcindeVarmi('mahalle', AdresBilgisi)+7 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mah :',AdresBilgisi)>0) Then begin {ShowMessage('3');} Mahalle:=IcindeVarmi(' mah :', AdresBilgisi)+6 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mah:',AdresBilgisi)>0) Then begin {ShowMessage('4');} Mahalle:=IcindeVarmi(' mah:', AdresBilgisi)+5 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mah.',AdresBilgisi)>0) Then begin {ShowMessage('5');} Mahalle:=IcindeVarmi(' mah.', AdresBilgisi)+5 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mah ',AdresBilgisi)>0) Then begin {ShowMessage('6');} Mahalle:=IcindeVarmi(' mah ', AdresBilgisi)+4 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mh.',AdresBilgisi)>0) Then begin {ShowMessage('7');} Mahalle:=IcindeVarmi(' mh.', AdresBilgisi)+3 ; end else
If (Mahalle=0 )and(IcindeVarmi(' mh ',AdresBilgisi)>0) Then begin {ShowMessage('8');} Mahalle:=IcindeVarmi(' mh ', AdresBilgisi)+2;end;
If (Cadde=0 )and(IcindeVarmi('caddesi',AdresBilgisi)>0) Then begin {ShowMessage('1');} Cadde:=IcindeVarmi('caddesi', AdresBilgisi)+7 ; end else
If (Cadde=0 )and(IcindeVarmi(' cadde',AdresBilgisi)>0) Then begin {ShowMessage('2');} Cadde:=IcindeVarmi(' cadde', AdresBilgisi)+6 ; end else
If (Cadde=0 )and(IcindeVarmi('cad :',AdresBilgisi)>0) Then begin {ShowMessage('3');} Cadde:=IcindeVarmi(' cad :', AdresBilgisi)+6 ; end else
If (Cadde=0 )and(IcindeVarmi(' cad:',AdresBilgisi)>0) Then begin {ShowMessage('4');} Cadde:=IcindeVarmi(' cad:', AdresBilgisi)+5 ; end else
If (Cadde=0 )and(IcindeVarmi('cad.',AdresBilgisi)>0) Then begin {ShowMessage('5');} Cadde:=IcindeVarmi('cad.', AdresBilgisi)+4 ; end else
If (Cadde=0 )and(IcindeVarmi(' cad ',AdresBilgisi)>0) Then begin {ShowMessage('6');} Cadde:=IcindeVarmi(' cad ', AdresBilgisi)+5 ; end else
If (Cadde=0 )and(IcindeVarmi(' cd.',AdresBilgisi)>0) Then begin {ShowMessage('7');} Cadde:=IcindeVarmi(' cd.', AdresBilgisi)+4 ; end else
If (Cadde=0 )and(IcindeVarmi(' cd ',AdresBilgisi)>0) Then begin {ShowMessage('8');} Cadde:=IcindeVarmi(' cd ', AdresBilgisi)+4;end;
If (Sokak=0 )and(IcindeVarmi('sokak',AdresBilgisi)>0) Then begin {ShowMessage('1');} Sokak:=IcindeVarmi('sokak', AdresBilgisi)+5 ; end else
If (Sokak=0 )and(IcindeVarmi(' sok :',AdresBilgisi)>0) Then begin {ShowMessage('2');} Sokak:=IcindeVarmi(' sok :', AdresBilgisi)+6 ; end else
If (Sokak=0 )and(IcindeVarmi(' sok:',AdresBilgisi)>0) Then begin {ShowMessage('3');} Sokak:=IcindeVarmi(' sok:', AdresBilgisi)+5 ; end else
If (Sokak=0 )and(IcindeVarmi(' sok.',AdresBilgisi)>0) Then begin {ShowMessage('4');} Sokak:=IcindeVarmi(' sok.', AdresBilgisi)+5 ; end else
If (Sokak=0 )and(IcindeVarmi('sok ',AdresBilgisi)>0) Then begin {ShowMessage('5');} Sokak:=IcindeVarmi('sok ', AdresBilgisi)+4 ; end else
If (Sokak=0 )and(IcindeVarmi(' sk.',AdresBilgisi)>0) Then begin {ShowMessage('6');} Sokak:=IcindeVarmi(' sk.', AdresBilgisi)+4 ; end else
If (Sokak=0 )and(IcindeVarmi(' sk ',AdresBilgisi)>0) Then begin {ShowMessage('7');} Sokak:=IcindeVarmi(' sk ', AdresBilgisi)+4;end;
If (SiteAdi=0 )and(IcindeVarmi('plaza',AdresBilgisi)>0) Then begin {ShowMessage('1');} SiteAdi:=IcindeVarmi('plaza', AdresBilgisi)+5 ; end else
If (SiteAdi=0 )and(IcindeVarmi('sitesi',AdresBilgisi)>0) Then begin {ShowMessage('2');} SiteAdi:=IcindeVarmi('sitesi', AdresBilgisi)+6 ; end else
If (SiteAdi=0 )and(IcindeVarmi(' sit.',AdresBilgisi)>0) Then begin {ShowMessage('3');} SiteAdi:=IcindeVarmi(' sit.', AdresBilgisi)+5 ; end else
If (SiteAdi=0 )and(IcindeVarmi(' st. ',AdresBilgisi)>0) Then begin {ShowMessage('4');} SiteAdi:=IcindeVarmi(' st.', AdresBilgisi)+4 ; end else
If (SiteAdi=0 )and(IcindeVarmi(' sit ',AdresBilgisi)>0) Then begin {ShowMessage('5');} SiteAdi:=IcindeVarmi(' sit ', AdresBilgisi)+5; end;
If (BlokAdi=0 )and(IcindeVarmi(' blok ',AdresBilgisi)>0) Then begin {ShowMessage('1');} BlokAdi:=IcindeVarmi(' blok ', AdresBilgisi)+5 ; end else
If (BlokAdi=0 )and(IcindeVarmi('blok ',AdresBilgisi)>0) Then begin {ShowMessage('2');} BlokAdi:=IcindeVarmi('blok ', AdresBilgisi)+5 ; end else
If (BlokAdi=0 )and(IcindeVarmi(' blok:',AdresBilgisi)>0) Then begin {ShowMessage('3');} BlokAdi:=IcindeVarmi(' blok:', AdresBilgisi)+6 ; end else
If (BlokAdi=0 )and(IcindeVarmi(' blk:',AdresBilgisi)>0) Then begin {ShowMessage('4');} BlokAdi:=IcindeVarmi(' blk:', AdresBilgisi)+5 ; end else
If (BlokAdi=0 )and(IcindeVarmi(' blk ',AdresBilgisi)>0) Then begin {ShowMessage('5');} BlokAdi:=IcindeVarmi(' blk ', AdresBilgisi)+5;end;
If (KapiNo=0 )and(IcindeVarmi(' numara',AdresBilgisi)>0) Then begin ShowMessage('1'); KapiNo:=IcindeVarmi('numara', AdresBilgisi)+6 ; end else
If (KapiNo=0 )and(IcindeVarmi(' no.',AdresBilgisi)>0) Then begin ShowMessage('2'); KapiNo:=IcindeVarmi(' no.', AdresBilgisi)+4 ; end else
If (KapiNo=0 )and(IcindeVarmi(' no ',AdresBilgisi)>0) Then begin ShowMessage('3'); KapiNo:=IcindeVarmi(' no ', AdresBilgisi)+5 ; end else
If (KapiNo=0 )and(IcindeVarmi(' no :',AdresBilgisi)>0) Then begin ShowMessage('4'); KapiNo:=IcindeVarmi(' no :', AdresBilgisi)+5 ; end else
If (KapiNo=0 )and(IcindeVarmi(' no:',AdresBilgisi)>0) Then begin ShowMessage('5'); KapiNo:=IcindeVarmi(' no:', AdresBilgisi)+4 ; end else
If (KapiNo=0 )and(IcindeVarmi(' n:',AdresBilgisi)>0) Then begin ShowMessage('6'); KapiNo:=IcindeVarmi(' n:', AdresBilgisi)+3 ; end else
If (KapiNo=0 )and(IcindeVarmi(' n :',AdresBilgisi)>0) Then begin ShowMessage('7'); KapiNo:=IcindeVarmi(' n :', AdresBilgisi)+4; end;
If (Daire=0 )and(IcindeVarmi('daire :',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi('daire :', AdresBilgisi)+7 ; end else
If (Daire=0 )and(IcindeVarmi('daire ',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi('daire ', AdresBilgisi)+7 ; end else
If (Daire=0 )and(IcindeVarmi(' d :',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi(' d :', AdresBilgisi)+4 ; end else
If (Daire=0 )and(IcindeVarmi(' d: ',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi(' d: ', AdresBilgisi)+4 ; end else
If (Daire=0 )and(IcindeVarmi(' d:',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi(' d:', AdresBilgisi)+3 ; end else
If (Daire=0 )and(IcindeVarmi('d:',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi('d:', AdresBilgisi)+2 ; end else
If (Daire=0 )and(IcindeVarmi(' d. ',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi(' d. ', AdresBilgisi)+4 ; end else
If (Daire=0 )and(IcindeVarmi(' d.',AdresBilgisi)>0) Then begin {ShowMessage('a');} Daire:=IcindeVarmi(' d.', AdresBilgisi)+3; end;
{$ENDREGION}
{$REGION ' onceki-sonraki-sirala '}
AdresSiralamasi.Items.Clear;
AdresSiralamasi.Sorted:=False;
Mah:=''; If Mahalle>0 Then begin If Mahalle<10 Then Mah:='00'+Mahalle.ToString else If Mahalle<100 Then Mah:='0'+Mahalle.ToString else Mah:=Mahalle.ToString; end;
Cad:=''; If Cadde>0 Then begin If Cadde<10 Then Cad:='00'+Cadde.ToString else If Cadde<100 Then Cad:='0'+Cadde.ToString else Cad:=Cadde.ToString; end;
Sok:=''; If Sokak>0 Then begin If Sokak<10 Then Sok:='00'+Sokak.ToString else If Sokak<100 Then Sok:='0'+Sokak.ToString else Sok:=Sokak.ToString; end;
Kap:=''; If KapiNo>0 Then begin If KapiNo<10 Then Kap:='00'+KapiNo.ToString else If KapiNo<100 Then Kap:='0'+KapiNo.ToString else Kap:=KapiNo.ToString; end;
Sit:=''; If SiteAdi>0 Then begin If SiteAdi<10 Then Sit:='00'+SiteAdi.ToString else If SiteAdi<100 Then Sit:='0'+SiteAdi.ToString else Sit:=SiteAdi.ToString; end;
Blo:=''; If BlokAdi>0 Then begin If BlokAdi<10 Then Blo:='00'+BlokAdi.ToString else If BlokAdi<100 Then Blo:='0'+BlokAdi.ToString else Blo:=BlokAdi.ToString; end;
Dai:=''; If Daire>0 Then begin If Daire<10 Then Dai:='00'+Daire.ToString else If Daire<100 Then Dai:='0'+Daire.ToString else Dai:=Daire.ToString; end;
Ilc:=''; If Ilce>0 Then begin If Ilce<10 Then Ilc:='00'+Ilce.ToString else If Ilce<100 Then Ilc:='0'+Ilce.ToString else Ilc:=Ilce.ToString; end;
Seh:=''; If Sehir>0 Then begin If Sehir<10 Then Seh:='00'+Sehir.ToString else If Sehir<100 Then Seh:='0'+Sehir.ToString else Seh:=Sehir.ToString; end;
Ulk:=''; If Ulke>0 Then begin If Ulke<10 Then Ulk:='00'+Ulke.ToString else If Ulke<100 Then Ulk:='0'+Ulke.ToString else Ulk:=Ulke.ToString; end;
If Mah<>'' Then AdresSiralamasi.Items.Add(Mah+' Mahalle');
If Cad<>'' Then AdresSiralamasi.Items.Add(Cad+' Cadde');
If Sok<>'' Then AdresSiralamasi.Items.Add(Sok+' Sokak');
If Kap<>'' Then AdresSiralamasi.Items.Add(Kap+' KapiNo');
If Sit<>'' Then AdresSiralamasi.Items.Add(Sit+' SiteAdi');
If Blo<>'' Then AdresSiralamasi.Items.Add(Blo+' BlokAdi');
If Dai<>'' Then AdresSiralamasi.Items.Add(Dai+' Daire');
If Ilc<>'' Then AdresSiralamasi.Items.Add(Ilc+' Ilce');
If Seh<>'' Then AdresSiralamasi.Items.Add(Seh+' Sehir');
If Ulk<>'' Then AdresSiralamasi.Items.Add(Ulk+' Ulke');
AdresSiralamasi.Sorted:=True;
For I:=0 To AdresListesi.RowCount-1 Do
For J:=0 To AdresListesi.ColCount-1 Do
AdresListesi.Cells[J,I]:='';
AdresListesi.RowCount:=2;
For I:=0 To AdresSiralamasi.Items.Count-1 Do
If Trim(AdresSiralamasi.Items.Strings[I])<>'' Then
begin
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[1,AdresListesi.RowCount-1]:=IntToStr(StrToIntDef(DegerCoz('sutun',Trim(AdresSiralamasi.Items.Strings[I])),0));
AdresListesi.Cells[2,AdresListesi.RowCount-1]:=DegerCoz('nesne',Trim(AdresSiralamasi.Items.Strings[I]));
If AdresListesi.RowCount-1=1 Then
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='0'
else
AdresListesi.Cells[0,AdresListesi.RowCount-1]:=IntToStr(StrToIntDef(AdresListesi.Cells[1,AdresListesi.RowCount-2],0)+1);
AdresListesi.RowCount:=AdresListesi.RowCount+1;
Application.ProcessMessages;
end;
{$ENDREGION}
//RzMemo2.Text:=AdresBilgisi;
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[0,I])<>'' Then
If
(AdresListesi.Cells[2,I]='Mahalle')or
(AdresListesi.Cells[2,I]='Cadde')or
(AdresListesi.Cells[2,I]='Sokak')or
(AdresListesi.Cells[2,I]='SiteAdi')or
(AdresListesi.Cells[2,I]='BlokAdi')
Then
AdresListesi.Cells[3,I]:=Trim(
Copy(
AdresBilgisi,
StrToInt(AdresListesi.Cells[0,I]),
StrToInt(AdresListesi.Cells[1,I])-StrToInt(AdresListesi.Cells[0,I])
)
);
Exit;
//Burası sınır...........................................................................
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[0,I])<>'' Then
begin
If AdresListesi.Cells[2,I]='KapiNo' Then
AdresListesi.Cells[3,I]:=Trim(
Copy(
AdresBilgisi,
StrToInt(AdresListesi.Cells[0,I])-1,
(StrToInt(AdresListesi.Cells[1,I])-StrToInt(AdresListesi.Cells[0,I]))+2
)
)
else
AdresListesi.Cells[3,I]:=Trim(
Copy(
AdresBilgisi,
StrToInt(AdresListesi.Cells[0,I]),
StrToInt(AdresListesi.Cells[1,I])-StrToInt(AdresListesi.Cells[0,I])
)
);
Application.ProcessMessages;
end;
Exit;
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[1,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[2,AdresListesi.RowCount-1]:='PostaKodu';
AdresListesi.Cells[3,AdresListesi.RowCount-1]:='';
AdresListesi.RowCount:=AdresListesi.RowCount+1;
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[1,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[2,AdresListesi.RowCount-1]:='Ilce';
AdresListesi.Cells[3,AdresListesi.RowCount-1]:='';
AdresListesi.RowCount:=AdresListesi.RowCount+1;
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[1,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[2,AdresListesi.RowCount-1]:='Sehir';
AdresListesi.Cells[3,AdresListesi.RowCount-1]:='';
AdresListesi.RowCount:=AdresListesi.RowCount+1;
AdresListesi.Cells[0,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[1,AdresListesi.RowCount-1]:='';
AdresListesi.Cells[2,AdresListesi.RowCount-1]:='Ulke';
AdresListesi.Cells[3,AdresListesi.RowCount-1]:='';
AdresListesi.RowCount:=AdresListesi.RowCount+1;
s1:='';
s2:='';
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[2,I])='KapiNo' Then
begin
beskarakter:=0;
If Trim(AdresListesi.Cells[3,I])<>'' Then
begin
s1:=Trim(AdresListesi.Cells[3,I]);
Form1.CumleParcala(s1,' ');
If Trim(Form1.ParcalanmisKelimeler.Text)<>'' Then
For t:=0 to Form1.ParcalanmisKelimeler.Lines.Count-1 Do
If Trim(Form1.ParcalanmisKelimeler.Lines.Strings[t])<>'' Then
begin
If Length(Trim(Form1.ParcalanmisKelimeler.Lines.Strings[t]))=5 Then
BesKarakter:=StrToIntDef(Trim(Form1.ParcalanmisKelimeler.Lines.Strings[t]),0);
If BesKarakter>0 Then Break;
end;
end;
If BesKarakter>0 Then
begin
For t:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[2,t])='PostaKodu' Then
AdresListesi.Cells[3,t]:=IntToStr(BesKarakter);
Break;
end;
{
else
If Trim(AdresListesi.Cells[3,I+1])<>'' Then //bir Alt Satir
begin
s1:=Trim(AdresListesi.Cells[3,I+1]);
Form1.CumleParcala(s1,' ');
If Trim(Form1.ParcalanmisKelimeler.Text)<>'' Then
begin
AdresListesi.Cells[3,I]:=Trim(AdresListesi.Cells[3,I]+' '+Form1.ParcalanmisKelimeler.Lines.Strings[0]);
s2:='';
try s2:=s2+' '+Form1.ParcalanmisKelimeler.Lines.Strings[1]; except end;
try s2:=s2+' '+Form1.ParcalanmisKelimeler.Lines.Strings[2]; except end;
try s2:=s2+' '+Form1.ParcalanmisKelimeler.Lines.Strings[3]; except end;
try s2:=s2+' '+Form1.ParcalanmisKelimeler.Lines.Strings[4]; except end;
AdresListesi.Cells[3,I+1]:=Trim(s2);
end;
Break;
end;
}
end;
//Olanı Temizleme
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[3,I])<>'' Then
AdresBilgisi:=Trim(AnsiReplaceText(AdresBilgisi,Trim(AdresListesi.Cells[3,I]),''));
//İlçe Şehir Bulma
s2:='';
If Trim(AdresBilgisi)<>'' Then
begin
{$REGION ' AdresBilgisi '}
If IcindeVarmi(' ',AdresBilgisi)>0 Then begin Form1.CumleParcala(AdresBilgisi,' '); a:=1; end;
If IcindeVarmi('/',AdresBilgisi)>0 Then begin Form1.CumleParcala(AdresBilgisi,'/'); a:=1; end;
If IcindeVarmi('-',AdresBilgisi)>0 Then begin Form1.CumleParcala(AdresBilgisi,'-'); a:=1; end;
If a=1 Then
If Trim(Form1.ParcalanmisKelimeler.Text)<>'' Then
begin
For I:=0 to Form1.ParcalanmisKelimeler.Lines.Count-1 Do
If Trim(Form1.ParcalanmisKelimeler.Lines.Strings[I])<>'' then
begin
s:=AnsiLowerCase(Trim(Form1.ParcalanmisKelimeler.Lines.Strings[I]));
{$REGION ' sehirler '}
if AnsiPos('adana', s)>0 then s2:='Adana' else
if AnsiPos('adiyaman', s)>0 then s2:='Adıyaman' else
if AnsiPos('afyon', s)>0 then s2:='Afyon' else
if AnsiPos('agri', s)>0 then s2:='Ağrı' else
if AnsiPos('amasya', s)>0 then s2:='Amasya' else
if AnsiPos('ankara', s)>0 then s2:='Ankara' else
if AnsiPos('antalya', s)>0 then s2:='Antalya' else
if AnsiPos('artvin', s)>0 then s2:='Artvin' else
if AnsiPos('aydin', s)>0 then s2:='Aydın' else
if AnsiPos('balikesir', s)>0 then s2:='Balıkesir' else
if AnsiPos('bilecik', s)>0 then s2:='Bilecik' else
if AnsiPos('bingol', s)>0 then s2:='Bingöl' else
if AnsiPos('bitlis', s)>0 then s2:='Bitlis' else
if AnsiPos('bolu', s)>0 then s2:='Bolu' else
if AnsiPos('burdur', s)>0 then s2:='Burdur' else
if AnsiPos('bursa', s)>0 then s2:='Bursa' else
if AnsiPos('canakkale', s)>0 then s2:='Çanakkale' else
if AnsiPos('cankiri', s)>0 then s2:='Çankırı' else
if AnsiPos('corum', s)>0 then s2:='Çorum' else
if AnsiPos('denizli', s)>0 then s2:='Denizli' else
if AnsiPos('diyarbakir', s)>0 then s2:='Diyarbakır' else
if AnsiPos('edirne', s)>0 then s2:='Edirne' else
if AnsiPos('elazig', s)>0 then s2:='Elazığ' else
if AnsiPos('erzincan', s)>0 then s2:='Erzincan' else
if AnsiPos('erzurum', s)>0 then s2:='Erzurum' else
if AnsiPos('eskisehir', s)>0 then s2:='Eskişehir' else
if AnsiPos('gaziantep', s)>0 then s2:='Gaziantep' else
if AnsiPos('giresun', s)>0 then s2:='Giresun' else
if AnsiPos('gumushane', s)>0 then s2:='Gümüşhane' else
if AnsiPos('hakkari', s)>0 then s2:='Hakkari' else
if AnsiPos('hatay', s)>0 then s2:='Hatay' else
if AnsiPos('isparta', s)>0 then s2:='Isparta' else
if AnsiPos('mersin', s)>0 then s2:='Mersin' else
if AnsiPos('istanbul', s)>0 then s2:='İstanbul' else
if AnsiPos('ist.', s)>0 then s2:='İstanbul' else
if AnsiPos('ist ', s)>0 then s2:='İstanbul' else
if AnsiPos('izmir', s)>0 then s2:='İzmir' else
if AnsiPos('kars', s)>0 then s2:='Kars' else
if AnsiPos('kastamonu', s)>0 then s2:='Kastamonu' else
if AnsiPos('kayseri', s)>0 then s2:='Kayseri' else
if AnsiPos('kirklareli', s)>0 then s2:='Kırklareli' else
if AnsiPos('kirsehir', s)>0 then s2:='Kırşehir' else
if AnsiPos('kocaeli', s)>0 then s2:='Kocaeli' else
if AnsiPos('konya', s)>0 then s2:='Konya' else
if AnsiPos('kutahya', s)>0 then s2:='Kütahya' else
if AnsiPos('malatya', s)>0 then s2:='Malatya' else
if AnsiPos('manisa', s)>0 then s2:='Manisa' else
if AnsiPos('kahramanmaras', s)>0 then s2:='Kahramanmaraş' else
if AnsiPos('k.maras', s)>0 then s2:='Kahramanmaraş' else
if AnsiPos('maras', s)>0 then s2:='Kahramanmaraş' else
if AnsiPos('maras ', s)>0 then s2:='Kahramanmaraş' else
if AnsiPos('mardin', s)>0 then s2:='Mardin' else
if AnsiPos('mugla', s)>0 then s2:='Muğla' else
if AnsiPos('mus', s)>0 then s2:='Muş' else
if AnsiPos('nevsehir', s)>0 then s2:='Nevşehir' else
if AnsiPos('nigde', s)>0 then s2:='Niğde' else
if AnsiPos('ordu', s)>0 then s2:='Ordu' else
if AnsiPos('rize', s)>0 then s2:='Rize' else
if AnsiPos('sakarya', s)>0 then s2:='Sakarya' else
if AnsiPos('samsun', s)>0 then s2:='Samsun' else
if AnsiPos('siirt', s)>0 then s2:='Siirt' else
if AnsiPos('sinop', s)>0 then s2:='Sinop' else
if AnsiPos('sivas', s)>0 then s2:='Sivas' else
if AnsiPos('tekirdag', s)>0 then s2:='Tekirdağ' else
if AnsiPos('tokat', s)>0 then s2:='Tokat' else
if AnsiPos('trabzon', s)>0 then s2:='Trabzon' else
if AnsiPos('tunceli', s)>0 then s2:='Tunceli' else
if AnsiPos('sanliurfa', s)>0 then s2:='Şanlıurfa' else
if AnsiPos('usak', s)>0 then s2:='Uşak' else
if AnsiPos('van', s)>0 then s2:='Van' else
if AnsiPos('yozgat', s)>0 then s2:='Yozgat' else
if AnsiPos('zonguldak', s)>0 then s2:='Zonguldak' else
if AnsiPos('aksaray', s)>0 then s2:='Aksaray' else
if AnsiPos('bayburt', s)>0 then s2:='Bayburt' else
if AnsiPos('karaman', s)>0 then s2:='Karaman' else
if AnsiPos('kirikkale', s)>0 then s2:='Kırıkkale' else
if AnsiPos('batman', s)>0 then s2:='Batman' else
if AnsiPos('sirnak', s)>0 then s2:='Şırnak' else
if AnsiPos('bartin', s)>0 then s2:='Bartın' else
if AnsiPos('ardahan', s)>0 then s2:='Ardahan' else
if AnsiPos('igdir', s)>0 then s2:='Iğdır' else
if AnsiPos('yalova', s)>0 then s2:='Yalova' else
if AnsiPos('karabuk', s)>0 then s2:='Karabük' else
if AnsiPos('kilis', s)>0 then s2:='Kilis' else
if AnsiPos('osmaniye', s)>0 then s2:='Osmaniye' else
if AnsiPos('duzce', s)>0 then s2:='Düzce';
{$ENDREGION}
If s2<>'' then
Break;
Application.ProcessMessages;
end;
end;
{$ENDREGION}
end;
If s2<>'' then
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[2,I])='Sehir' Then
begin
AdresListesi.Cells[3,I]:=s2;
//RzMemo2.Text:=AnsiReplaceText(RzMemo2.Text,s2,'');
Break;
end;
For I:=0 To AdresListesi.RowCount-1 Do
If
(Trim(AdresListesi.Cells[2,I])='KapiNo')or
(Trim(AdresListesi.Cells[2,I])='SiteAdi')or
(Trim(AdresListesi.Cells[2,I])='BlokAdi')or
(Trim(AdresListesi.Cells[2,I])='Ilce')or
(Trim(AdresListesi.Cells[2,I])='Sehir')
Then
begin
s1:='';
s1:=Trim(AdresListesi.Cells[3,I]);
Form1.CumleParcala(s1,' ');
If Trim(Form1.ParcalanmisKelimeler.Text)<>'' Then
For J:=0 To Form1.ParcalanmisKelimeler.Lines.Count-1 Do
begin
a:=0;
a:=StrToIntDef(Form1.ParcalanmisKelimeler.Lines.Strings[J],0);
If a>9999 then
begin
For t:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[2,t])='PostaKodu' Then
begin
AdresListesi.Cells[3,t]:=Trim(Form1.ParcalanmisKelimeler.Lines.Strings[J]);
AdresListesi.Cells[3,I]:=Trim(AnsiReplaceText(AdresListesi.Cells[3,I],Trim(Form1.ParcalanmisKelimeler.Lines.Strings[J]),''));
Break;
end;
Break;
end;
Application.ProcessMessages;
end;
end;
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[3,I])<>'' Then
RzMemo2.Text:=AnsiReplaceText(RzMemo2.Text,Trim(AdresListesi.Cells[3,I]),'');
If Trim(RzMemo2.Text)<>'' then
For I:=0 To AdresListesi.RowCount-1 Do
If Trim(AdresListesi.Cells[2,I])='Ilce' Then
begin
AdresListesi.Cells[3,I]:=Trim(RzMemo2.Text);
//RzMemo2.Text:=AnsiReplaceText(RzMemo2.Text,s2,'');
Break;
end;
end;
end.
unit1.dfm
Kod: Tümünü seç
object Form1: TForm1
Left = 0
Top = 0
Caption = 'Form1'
ClientHeight = 464
ClientWidth = 311
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object AdresCoz: TRzButton
Left = 112
Top = 431
Caption = 'Adresi '#199#246'z'
TabOrder = 0
OnClick = AdresCozClick
end
object RzMemo1: TRzMemo
Left = 8
Top = 8
Width = 297
Height = 50
TabOrder = 1
FrameStyle = fsStatus
FrameVisible = True
end
object RzMemo2: TRzMemo
Left = 8
Top = 367
Width = 297
Height = 55
TabOrder = 2
FrameStyle = fsStatus
FrameVisible = True
end
object AdresListesi: TRzStringGrid
Left = 8
Top = 59
Width = 297
Height = 302
ColCount = 4
DrawingStyle = gdsGradient
FixedCols = 0
RowCount = 2
TabOrder = 3
FrameHotStyle = fsStatus
FrameStyle = fsStatus
FrameVisible = True
ColWidths = (
31
27
67
154)
end
object AdresSiralamasi: TListBox
Left = -104
Top = 60
Width = 97
Height = 164
BorderStyle = bsNone
ItemHeight = 13
TabOrder = 4
end
object ParcalanmisKelimeler: TRzMemo
Left = 200
Top = 584
Width = 185
Height = 89
TabOrder = 5
end
end
AdresCoz.dproj
Kod: Tümünü seç
program AdresCoz;
uses
Vcl.Forms,
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.
Cadde :
Sokak :
Kapı No :
Site Adı :
Blok Adı :
Daire :
Posta Kodu :
İlçe :
Şehir :
Ülke :
şeklinde ayrı ayrı veri almak istiyorum.
Teşekkürler,