PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
  • Conversion range
  • Val function and UNICODE
  • Miscellaneous
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Returns the numeric value of a character string. This feature enables you to perform numeric calculations on the character strings.
Example
Val("143")    // Returns 143
Val("1.67")   // Returns 1.67
Val("ABC")    // Returns 0
Val("3plus2") // Returns 3
Val("7,5")    // Returns 7
Val("1D2")    // Returns 100
Val("2.5e-2") // Returns 0.025
Syntax
<Result> = Val(<Initial string>)
<Result>: Real or integer
  • Numeric value of the string.
  • 0 if an error occurs.
<Initial string>: Character string
Character string to convert to a numeric value.
For a real, the separator must be the dot ('.') and the prefixes for scientific notation can be 'E', 'e', 'D' or 'd'. If the separator is a comma, the numbers after the comma will be ignored.
Remarks

Conversion range

Val converts a string to an integer if the value is between -9.223.372.036.854.775.808 and 9.223.372.036.854.775.807.

Val function and UNICODE

The <Initial string> can be an ANSI or UNICODE string
For more details on UNICODE, see Managing UNICODE.

Miscellaneous

If a character of <Initial string> cannot be interpreted as a number, Val stops interpreting <Initial string> and returns the number corresponding to the characters already read.
Reals can be converted from base 10 only. In other bases, all characters after "." (point) will be ignored.
Related Examples:
The Val function Unit examples (WINDEV): The Val function
[ + ] Using the WLanguage "Val" function with different databases.
For example, it allows you to retrieve the decimal value of a string in Hexadecimal format.
Component: wd260vm.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment