Sha256: 790060a27f74dd4e08940a818719971ef4eecffe997bdd335b525c7f0d575272

Contents?: true

Size: 520 Bytes

Versions: 7

Compression:

Stored size: 520 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

7 entries across 7 versions & 1 rubygems

Version Path
fe_core_ext-0.1.16 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.15 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.14 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.13 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.12 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.11 lib/fe_core_ext/core_ext/string.rb
fe_core_ext-0.1.8 lib/fe_core_ext/core_ext/string.rb