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-3.0.4 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.3 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-3.0.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.12.3 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.12.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.12.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.12.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.11.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.11.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.10.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.9.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.8.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.8.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.8.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.7.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.7.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.6.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.5.0 lib/cocoa/sugarcube-numbers/nsstring.rb