Val

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Cantor.

Hi!

Normally (in other BASIC languages) "Val(A8)" results "8", but PureBasic doesn't filter the letters and results "178". Is it a bug or a feature?

Best regards,
Martin.

--
Best regards,
Martin
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Rings.

A8 -> Hex to Dez = 168

Siggi
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Cantor.
A8 -> Hex to Dez = 168

Siggi
But the val-function has to convert a STRING to a number by filtering all letters. It is unusual in BASIC-dialects for it to convert from a Hex-number.

Best regards, Martin

--
Best regards,
Martin
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Mr.Skunk.

Hello

Has said in the PB Doc :
"TRANSFORM a string into a numeric value. The string must be an integer in decimal format."

I think you're right Cantor, it's not a bug, it looks like a not well named function (as VAL usually filter and not transform the string)...


Mr Skunk

Mr Skunk's PureBasic Web Page
http://www.skunknet.fr.st
Post Reply