Arsip: remove duplicate string

 
user image
more 14 years ago

r_rie

alo sob semua, mo nanya lagi nih gmana ya caranya ngilangin char yg sama dalam suatu string, misalkan 'aabbcdee' trus hasilnya jadi 'abcde' ada yg bisa bantu gak, thanks,.. :P :P
user image
more 14 years ago

DelphiExpert

1. Sediakan hash table 2. Scan char dlm string, masukkan char yg ditemukan kedalam hash table jika tidak ditemukan, concat hasil := hasil + char 3. kalo ditemukan tinggal skip aja lanjut ke next charakter
user image
more 14 years ago

r_rie

waduh, masih blm ngerti neh om, gmana ya, ?????
user image
more 14 years ago

DelphiExpert

monggo saya persilahken master-master bikin snapshot codenya :lol:
user image
more 14 years ago

DelphiExpert

ngantuk2 daripada bikinin code snippet nemu ini monggo diolah sendiri...
user image
more 14 years ago

n3o_cybertech

iseng2 asal jadi aja, tercipta kode sperti ini :

procedure TForm1.RemoveDuplicateString(var ASource: string);
var
  i: Integer;
begin
  for i:=Length(ASource) downto 1 do
  begin
    if i < Length(ASource) then
    begin
      if ASource[i] = ASource[i + 1] then
        Delete(ASource,i,1);
    end;
  end;
end;
monggo klo ada yang lebih simple :) ubah karakter "&lt;" menjadi "<"
user image
more 14 years ago

sikuper85

@n3o_cybertech: iseng2 asal jadi aja, tercipta kode sperti ini :

procedure TForm1.RemoveDuplicateString(var ASource: string);
var
  i: Integer;
begin
  for i:=Length(ASource) downto 1 do
  begin
    if i < Length(ASource) then
    begin
      if ASource[i] = ASource[i + 1] then
        Delete(ASource,i,1);
    end;
  end;
end;
monggo klo ada yang lebih simple :) ubah karakter "&lt;" menjadi "<"
gini lebih simpel ga yah...

procedure TForm1.RemoveDuplicateStringV2(var ASource: string);
var
  i: Integer;
begin
  for i:=Length(ASource)-1 downto 1 do
    if ASource[i] = ASource[i + 1] then
      Delete(ASource,i,1);
end;
user image
more 14 years ago

mas_kofa

@n3o : itu kalo abjadnya urut...kalo gak urut begimano ayo....???
user image
more 14 years ago

n3o_cybertech

@mas_kofa: @n3o : itu kalo abjadnya urut...kalo gak urut begimano ayo....???

procedure TForm1.RemoveDuplicateString(var ASource: string);
var
  i,idx: Integer;
begin
  for i:= 1 to Length(ASource) do
  begin
    for idx := Length(ASource) downto i + 1 do
      if ASource[i] = ASource[idx] then
        Delete(ASource,idx,1);
  end;
end;
:D
user image
more 14 years ago

daryl_sukma_gumilar

@ Master N3o : NICE !! Like This ... !! Hhe
more ...
  • Pages:
  • 1
  • 2
Share to
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com