Navigation
Synopsis Convert a string value to real.
Function real toReal(str s)
Usage import String;
Description Converts string s to a real. Throws IllegalArgument when s cannot be converted.
Examples
rascal>import String;
ok
rascal>toReal("2.5e-3");
real: 0.0025
rascal>toReal("123");
real: 123.
rascal>toReal("abc");
|rascal://String|(10539,323,<455,0>,<470,31>): IllegalArgument()
	at *** somewhere ***(|rascal://String|(10539,323,<455,0>,<470,31>))
	at toReal(|stdin:///|(7,5,<1,7>,<1,12>))


Is this page unclear, or have you spotted an error? Please add a comment below and help us to improve it. For all other questions and remarks, visit ask.rascal-mpl.org.