Sha256: d83c6468a07734718f14e61e757a053eb5eb9e20dd386995808ccd0d006f0452

Contents?: true

Size: 538 Bytes

Versions: 6

Compression:

Stored size: 538 Bytes

Contents

# Class for working with strings
module OoxmlParser
  class StringHelper
    class << self
      # This method check if string contains numeric
      # @return [True, False] result of comparison
      def numeric?(string)
        true if Float(string)
      rescue ArgumentError
        false
      end

      # Check if string is complex number
      # @return [True, False] result of comparison
      def complex?(string)
        true if Complex(string.tr(',', '.'))
      rescue ArgumentError
        false
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ooxml_parser-0.4.1 lib/ooxml_parser/helpers/string_helper.rb
ooxml_parser-0.4.0 lib/ooxml_parser/helpers/string_helper.rb
ooxml_parser-0.3.0 lib/ooxml_parser/helpers/string_helper.rb
ooxml_parser-0.2.0 lib/ooxml_parser/helpers/string_helper.rb
ooxml_parser-0.1.2 lib/ooxml_parser/helpers/string_helper.rb
ooxml_parser-0.1.1 lib/ooxml_parser/helpers/string_helper.rb