Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Impressum similarity.inc.~28~   Sprache: unbekannt

 
//-------------------------------------------------------
//
//-------------------------------------------------------
function issimilar(L, R: String): boolean;
var
  vl, vr: String;
  res: boolean;
  //---------------------------------------------------------------
  function isPrefix(S1, S2: String): boolean;
  begin
    if (length(S1)<3) or (length(S1) > length(S2)) then
      result := false
    else
      result := MidStr(S2, 1, length(S1)) = S1
  end;
  //---------------------------------------------------------------
  function isnumber(S: String): boolean;
  var
    i,d,ll: integer;
    res: boolean;
  begin
    res := true;
    if length(S) = 0 then
      res := false;
    for i := 1 to length(S) do
      res := res and charinset(S[i], ['0' .. '9', '.', ',', '+', '-',
        '$', '€']);
    d:=pos('.',S);
    if d>0 then begin
      ll:=length(S);
      d:=pos('.',midstr(S,D+1,ll));
      res:=res and (d<0)
    end;
    result := res;
  end;

begin
  //
  res := false;
  //remove separators
  vl := StringReplace(vl, FDB, '', [rfReplaceAll]);
  vr := StringReplace(vr, FDB, '', [rfReplaceAll]);
  //
  if isnumber(vl) and isnumber(vr) then begin
    //
    if charinset(vl[1],['-','+']) then vr:=midstr(vr,2,length(vr));
    if charinset(vr[1],['-','+']) then vr:=midstr(vr,2,length(vr));
    // trailing 0's
    while (length(vl)>1) and (vl[length(vl)]='0') do vl:=midstr(vl,1,length(vl)-1);
    while (length(vr)>1) and (vr[length(vr)]='0') do vr:=midstr(vr,1,length(vr)-1);
    //
    res := vl = vr;
  end;
  //
  result := res;
end;

[ Seitenstruktur0.32Drucken  etwas mehr zur Ethik  ]

                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge