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-2.4.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.4.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.4.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.3.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.2.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.5 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.4 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.3 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.1.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.0.2 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.0.1 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-2.0.0 lib/cocoa/sugarcube-numbers/nsstring.rb
sugarcube-1.7.0 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.6.3 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.6.2 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.6.1 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.6.0 lib/sugarcube-numbers/nsstring.rb
sugarcube-1.5.9 lib/sugarcube-numbers/nsstring.rb