val is a function that converts character data composed of numeric symbols into corresponding numeric data. Its syntax is "Val(S,V,Code)". If non-numeric characters appear in the string, then Only the first part of the non-numeric character is converted; if the first character of the string is not a numeric character, the value zero is returned, but leading spaces are ignored.
#The operating environment of this article: windows10 system, thinkpad t480 computer.
val is a function that converts character data composed of numeric symbols (including positive and negative signs, decimal points) into corresponding numerical data.
Use format usage: Val(S,V,Code)
If non-numeric characters appear in the string, only the part before the non-numeric characters will be converted; if the first character of the string is not numeric sign, the value zero is returned, but leading spaces are ignored.
Note that the Val function only treats the period (.) as a usable decimal separator. When using a different decimal separator, such as in international versions of the application, CDbl is used instead to convert the string to a number.
Example:
text1.text = "10" text2.text = "11" text3.text = val(text1.text)+val(text2.text)
The returned value is 21.
For more knowledge about computer programming, please visit:Introduction to Programming! !
The above is the detailed content of what function is val. For more information, please follow other related articles on the PHP Chinese website!