-
-
Notifications
You must be signed in to change notification settings - Fork 19
real
CryoEagle edited this page Dec 26, 2018
·
7 revisions
Transforms a string into a real number.
real(str, evaluate = false)| Argument | Description |
|---|---|
string str |
String to be converted |
bool evaluate |
If set to true, mathematical parser will be applied |
Returns: double
This function is used to change a string into a real number. With evaluate set to false this will simply try to parse str to a double and return it. In case of failure (a string with nondigit characters is provided), this will fail and return Double.Nan. When evaluate is set to true, lexical parser will try to eval expression, falling to Double.Nan.
double val = real("5");Sets the variable val to 5.
double val = real("2 + 8 + 12 * (4 - 3)", true); // returns 22 If we didn't set the second argument to true, this would return Double.Nan instead.
Back to strings