How to check if a string can be parsed to decimal?
I am looking at a string attribute that holds alpha-numeric values. Before the parse operation, I need to check if the string holds values that can be parsed. For example the string “5.6” should be parsed but the string “A” should not be. How can I identify if a string holds a value that can be parsed?
You can check with regex if the string only consists of numerals or you can do the parse and catch the exception it will throw (see docs on error handling)
The parseDecimalfunction can receive a default value that will be returned if the value cannot be parsed maybe you can use it.