![]() |
StrToInt löst keine exception aus
Delphi-Quellcode:
Hallo, mein problem ist eigentlich ganz einfach zu beschreiben.
try
i:= StrToInt(DBEdit20.Text); except begin ShowMessage('Seriennummer Falsch! Bitte nochmals eingeben!'); DBEdit20.SetFocus; end; end; Wenn der String 'x00001' in das Editfeld eingetragen wird, dann löst das keine Exception aus, warum? Gruß Hendrik |
Re: StrToInt löst keine exception aus
Weil x keine Zahl ist. :)
MfG freak |
Re: StrToInt löst keine exception aus
Habt iht mal seine Frage gelesen? Es löst KEINE Exception aus..
müsste es aber wenn ich StrToInt('x0001') ausführe |
Re: StrToInt löst keine exception aus
Also les ich falsch, oder die anderen? :D
Ich tippe, dass x00001 als Hexadezimalwert erkannt und entsprechend in das Dezimalsystem umgerechnet wird. Daher keine Exception. |
Re: StrToInt löst keine exception aus
Zitat:
|
Re: StrToInt löst keine exception aus
Und wenn ich mich noch mehr richtig erinner wird 00001 als Oktalzahl erkannt ;)
|
Re: StrToInt löst keine exception aus
Aber durchaus ne interessante Sache. :zwinker:
Ohh...ne'n Kieler... :cheers: |
Re: StrToInt löst keine exception aus
Aha, das ist ja schon mal interessant.
Aber wieso ist X ein Teil einer Hexadezimalzahl? Das geht doch nur bis 'F', oder. Zudem ist sehr interessant, dass das Ergebnis von i = 1 ist. Gruß Hendrik aus Kiel :-) |
Re: StrToInt löst keine exception aus
x markiert das nun eine Hexazeizmalzahl kommt.
Hex(Basis16) 00001 ist auch nur 1. x00011 sollte dann als Integer 17 geben Grüße Klaus |
Re: StrToInt löst keine exception aus
Moin Zusammen,
um die Aussage von Klaus noch etwas zu vervollständigen: 0x ist in C, was $ in Delphi ist, und der Delphi-Compiler erkennt das, dummerweise, auch als gültig an. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 03:24 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