Home> Common Problem> body text

what function is val

藏色散人
Release: 2021-02-04 18:35:08
Original
12468 people have browsed it

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.

what function is val

#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)
Copy after login

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!

Related labels:
val
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
Find elements in two JavaScript arrays