A proper noob question about string to int conversion

Just starting out? Need help? Post your questions and find answers here.
Beeps
New User
New User
Posts: 5
Joined: Thu Mar 11, 2004 6:29 pm
Location: UK
Contact:

A proper noob question about string to int conversion

Post by Beeps »

Right then, I've got a string...

Code: Select all

A$="123"
...and I want to use it as a number but..

Code: Select all

int(A$)
...always gives me 0, what do i need to do to convert a string to a numeric?
Time is an illusion, lunchtime doubly so!
- www.coolgames.tv -
- www.binary-people.com -
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

Use Val() to convert a string into an integer (byte, word, long), or
ValF() to convert it into a Float value.

Timo
quidquid Latine dictum sit altum videtur
Beeps
New User
New User
Posts: 5
Joined: Thu Mar 11, 2004 6:29 pm
Location: UK
Contact:

Post by Beeps »

I new it would be simple, just couldn't find it in the docs.

Thanks.
Time is an illusion, lunchtime doubly so!
- www.coolgames.tv -
- www.binary-people.com -
Kris_a
User
User
Posts: 92
Joined: Sun Feb 15, 2004 8:04 pm
Location: Manchester, UK

Post by Kris_a »

Beeps wrote:... just couldn't find it in the docs.
Join the club :D
Post Reply