![]() |
java to delphi
I am trying to translate this java code to delphi:
Delphi-Quellcode:
String FlashG(int fromINT, int toINT)
{ StringBuffer stringbuffer = new StringBuffer(); int PPP; for(PPP = toINT; PPP < fromINT; PPP *= toINT); do { int OOP = fromINT / PPP; char COMP = (char)(LEVEL + OOP); stringbuffer.append(COMP); fromINT -= PPP * OOP; PPP /= toINT; } while(PPP > 0); return stringbuffer.toString(); } LEVEL = 'K'; It goes fine to the point of the for loop. Can't figure it out.. PPP is changed in the for loop? If anyone can translate it, it will be greatly appreciated. Cheers Regards PasTra |
Re: java to delphi
As you didn't tell what the code is for I couldn't test it. A direct translation should be:
Delphi-Quellcode:
The naming conventions are different in Delphi but I didn't change it.
function FlashG(fromINT, toINT: Integer): String;
var PPP, OOP: Integer; begin Result := ''; PPP := toINT; while PPP < fromInt do PPP := PPP * toINT; repeat OOP := fromInt div PPP; Result := Result + Chr(Ord('K') + OOP); fromInt := fromInt - PPP * OOP; PPP := PPP div toInt; until PPP <= 0; end; |
Alle Zeitangaben in WEZ +1. Es ist jetzt 02:49 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 by Thomas Breitkreuz