Skip to content

Parsing of Strings into Floats and Integers

Yorick Peterse requested to merge string-to-number into master

This adds support for parsing a String into a Float and an Integer. There are two ways of doing so:

  1. By sending to_integer or to_float to a String.
  2. Using Integer.from_string or Float.from_string.

Using to_integer and to_float will perform a lossy conversion: returning 0 or 0.0 for invalid input. Using the from_string methods will result in a strict conversion, with an error being thrown for invalid input.

Fixes #134 (closed) Fixes #156 (closed)

Merge request reports