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-4.0.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.5.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.4.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.4.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.4.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.7 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.6 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.5 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.4 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.3 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.3.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.2.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.1.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.1.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.8 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.7 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.6 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.5 lib/cocoa/sugarcube-numbers/nsstring.rb