CasewareDocs

Str2Dbl

This function takes a numeric string value and converts it into a double value.

Compatibility

Available as of IDEA version 9.0

Syntax

Str2Dbl()

Remarks

In case a string cannot be converted into a double an exception is thrown.

Str2Dbl shall interpret both decimal separators (dot and comma) as a decimal separator. This means "123.45" and "123,45" will return with the same regional settings "123.45". Thousand separators are not supported by this function.

Example

Option Explicit 
Sub Main()
On Error GoTo erh
Dim d As Double
Dim cmds As Object

Set cmds = SmartContext.MacroCommands.SimpleCommands

d = cmds.Str2Dbl("4.01")
d = d + 0.01 'd = 4.02
d = cmds.Str2Dbl("4,01")
d = d + 0.01 'd = 4.02
Exit Sub
erh:
'conversion failed
End Sub
Str2Dbl | Caseware Docs