Sha256: 42164ecc7370b8d34a51da5048aaab8445302a392a991c58e20155fd81850eb9

Contents?: true

Size: 519 Bytes

Versions: 1

Compression:

Stored size: 519 Bytes

Contents

require 'bigdecimal'
require 'bigdecimal/util'

module FeCoreExt::CoreExt
end

module FeCoreExt::CoreExt::String
  def to_integer
    return if not_number?
    delete(',').to_i
  end

  def to_decimal
    return if not_number?
    delete(',').to_d
  end

  def not_number?
    to_i == 0 && match('0').nil?
  end

  def zen_to_han
    tr('0-9A-Za-z &・-()', '0-9A-Za-z &・-()')
  end

  def to_katakana
    tr('ぁ-ん','ァ-ン')
  end
end

class String
  include FeCoreExt::CoreExt::String
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fe_core_ext-0.1.7 lib/fe_core_ext/core_ext/string.rb