method

to_d

Importance_1
Ruby latest stable (v2_5_5) - 0 notes - Class: String
to_d() public

Returns the result of interpreting leading characters in str as a BigDecimal.

require 'bigdecimal'
require 'bigdecimal/util'

"0.5".to_d             # => 0.5e0
"123.45e1".to_d        # => 0.12345e4
"45.67 degrees".to_d   # => 0.4567e2

See also BigDecimal::new.

Show source
Register or log in to add new notes.