AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Java to pascal/delphi

Ein Thema von pastra · begonnen am 23. Jun 2006 · letzter Beitrag vom 25. Jun 2006
Antwort Antwort
Benutzerbild von s.h.a.r.k
s.h.a.r.k

Registriert seit: 26. Mai 2004
3.159 Beiträge
 
#1

Re: HELP: JAVA TO PASCAL/DELPHI

  Alt 23. Jun 2006, 22:45
Try this code - there is no guaranty that it's right
Delphi-Quellcode:
function decodeStringF2(QStringBuffer : TStringList; s: String): TStringList;
var
  i, k, j, l : Integer;
  c : Char;
  Buffer : TStringList;
begin
  Buffer := QStringBuffer;

  if(s <> '') then
  begin
    i := length(s);

    // i had to replace the for because i can't change an counter in a for
    j := 1; // Index in a String is different - in Delphi it starts with 1
    while j < i do
    begin
      c := s[j];
      if c = '&then
      begin
        if (i < j+5) then break;

        k := 0;
        for l := 0 to 3 do
        begin
          inc(j);
          k := k*16;
          k := k + StrToInt(s[j]) - 65; // Here you habe to be careful! The character here must be a number!
        end;
      end
      else begin
        Buffer.Append(c);
      end;
      inc(j);
    end;
  end;

  Result := Buffer;
end;

function decodeStringF1(s: String): String;
var
  Buffer : TStringList;
begin
  Buffer := TStringList.Create;
  Buffer := decodeStringF2(Buffer, s);
  Result := Buffer.Text;
end;
// Edit
Deleted some test-code!
»Remember, the future maintainer is the person you should be writing code for, not the compiler.« (Nick Hodges)
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 05:39 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz