PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Range for conversion
  • Val function and UNICODE
  • Various
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.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 16 and later
Universal Windows 10 App This function is now available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This function is now available for the Windows Phone applications.
Universal Windows 10 App This function is now available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This function is now available for the iPhone/iPad applications.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
New in version 18
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Android Widget This function is now available in Android Widget mode.
Universal Windows 10 App This function is now available in Windows Store apps mode.
Versions 21 and later
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
New in version 21
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
Apple Watch This function is now available in Apple Watch mode.
Universal Windows 10 App This function is now available in Universal Windows 10 App mode.
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(<Source String> [, <Base Used>])
<Result>: Real or integer
  • Numeric value of the string.
  • 0 if an error occurred.
AndroidAndroid Widget Java In this version, <Result> corresponds to a real.
<Source String>: Character string
Character string to convert into 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 found after the comma will be ignored.
<Base Used>: Character string or integer (optional)
Base in which the number is represented. The possible values are as follows:
  • "d": base 10 (decimal)
  • "x": base 16 (hexadecimal)
  • "o": base 8 (octal)
  • an integer included between 2 and 36
Base 10 is used by default.
WEBDEV - Browser codeUniversal Windows 10 App This parameter is not available. Base 10 is automatically used.
Remarks

Range for conversion

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

Val function and UNICODE

<Source String> can be in ANSI format or in UNICODE format.
See Managing the UNICODE format for more details.

Various

As soon as a character of <Source String> cannot constitute a number, Val stops interpreting <Source String> and returns the number corresponding to the characters already read
The reals can be converted from base 10 only. In the other bases, the characters found after the "." character (dot) 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.
Components
WINDEVWEBDEV - Server codeReports and Queries wd230vm.dll
Windows Mobile wp230vm.dll
WEBDEV - Browser code WDJS.DLL
Java wd230java.jar
Linux wd230vm.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment