I’m trying to read a number from a user input (string) like:
' Where "." is grouping separator and "," is the decimal character
dim strUserInput as string = "172.500,00"
dim ret as double
' Produces 172.5 ("." is the decimal separator)
ret = val(strUserInput)
'
' Alternative Way
' Still producing 172.5
strUserInput = strUserInput.tostring(CultureInfo.InvariantCulture) 'nothing changes
ret = val(strUserInput)
How can I correctly use CultureInfo to return 172,500.00 (or 172500,00 or just 172500) to a double var?
From the MSDN documentation for val: