Number Functions - Conversion Functions

Number Functions - Conversion Functions

To retrieve any numbers present in a string the Val Function can be used. The Val function uses the following syntax:

Val(String)

The following code retrieves any numbers present in the given String, and adds it into a textbox

Dim Num As String
Num = “Year: 2007, date: 25″
Text1.Text = Val(Num)  ‘ Text1 will contain 200725

The Int function converts a number to integer value(whole number). The following code converts the decimal number to a whole number.

Dim Num As Single
Num = 123.45
Msgbox Int(Num)

o/p : 123

Other Functions:

Int - Converts a number to a Integer
CLng - Converts a number to a Long
Hex - Converts a number to Hex

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.