Sha256: be69df00833a2427dccb1b8be5c6d015be8cbdd984b91c22127a74166925f996

Contents?: true

Size: 399 Bytes

Versions: 64

Compression:

Stored size: 399 Bytes

Contents

class NSString

  # @return boolean
  def nan?(style=NSNumberFormatterDecimalStyle)
    self.to_number(style).nil?
  end

  def to_number(style=NSNumberFormatterDecimalStyle)
    if style.respond_to?(:nsnumberstyle)
      style = style.nsnumberstyle
    end
    number_formatter = NSNumberFormatter.new
    number_formatter.numberStyle = style
    number_formatter.numberFromString(self)
  end

end

Version data entries

64 entries across 64 versions & 1 rubygems

Version Path
sugarcube-1.5.8 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.5.7 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.5.6 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.5.5 lib/sugarcube-numbers/nsstring.rb