Val

Converts numeric characters and the first period found that occur at the beginning of a string to a number.

A period not accompianied by at least one numeric digit will be ignored. If no numeric digits are found at the start of the string, zero will be returned.

Method Signature

Val(string=[string])

Arguments

Argument
Type
Required
Description
Default

string

string

true

The string to parse

Examples

Numeric characters at beginning and middle of a string

Run Example

val( "120test12sstring" );

Result: 120

Numeric characters only at the end of a string

Run Example

Result: 0

Additional Examples

Run Example

Last updated

Was this helpful?