converting string to integer

How do i convert a string to integer which is to large and exceed 2147483647 in delphi 3 ?

Thank you.      
n_chaiAsked:
Who is Participating?
 
rickpetConnect With a Mentor Commented:
You should use a comp type...

In Delphi 3 this is 64bit integer though internally it is a Floating Type.

from Delphi 3 help.
The Comp (computational) type is a 64-bit integer that holds integral values from
-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 (-263 to 263-1).

0
 
dwwangCommented:
Why not convert it to double/extended?

You know, even you can convert it to an "integer", it will result in no use because it cannot participate any calculation with other integers due to exceeding the limit of this type.
0
 
MadshiCommented:
If you've Delphi4 you can use StrToInt64 and you'll get an 8 byte integer (int64) as a result.

Regards, Madshi.
0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
binkzzCommented:
Otherwise just StrToInt(); will do

Bink
0
 
StevenBCommented:
 ... or StrToIntDef() and avoid having to handle your own exceptions.
0
 
philipleighsCommented:
4 byte signed integers (D3 Integer type) can't represent numbers greater than 2^31-1, that's why StrToInt fails.
There is no 4 byte unsigned type in D3, it could have been Cardinal or DWORD, but they are both declared as Integer (I think). At least then you could have got to 2^32-1.

As dwwang says, use Extended remembering that they don't represent integers very well.

What's the nature of your app any, and why the big numbers?
0
 
slautinCommented:
You must use 8 or more bytes for storing lage values.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.