Re: number beginning with zerro



"Gert Baars" <g.baars13@xxxxxxxxx> wrote in news:TTFqi.2225$Rv4.368
@amstwist00:


"surena" <surena_abari@xxxxxxxxx> wrote in message
news:1185602037.288281.145160@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hi,

I put a number in an edit box and want to change it to a number. I
used strtoint function. It did
not work with phone numbers like 05713234, apparently due to 0. Why?
This number equals to 5713234. But Delphi does
not agree!

Surena.


Look at the stringfunctions in Delphi help.
There is a copy function so the leading
digit can be skipped if zero. Then
use strtoint on the copied string.

StrToInt works perfectly well in Delphi:

ShowMessage(Format('%d', [StrToInt('05713234')]));

displays 5713234 as expected. There is no need to use Copy.

.



Relevant Pages

  • Re: Looking for super fast CSV parser
    ... Cant You do something like this in Delphi? ... atoi 0.484 Sec. ... I wrote something like your code yesterday and it was twice as fast as StrToInt which I thought was pretty good. ...
    (borland.public.delphi.thirdpartytools.general)
  • Trailing space causes exception in StrToInt
    ... According to "Delphi in a Nutshell", StrToInt ignores leading and ... trailing whitespace. ... But it appears that in Delphi 7, ... or is the nutshell book in error? ...
    (comp.lang.pascal.delphi.misc)