Class: OoxmlParser::StringHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/ooxml_parser/helpers/string_helper.rb

Overview

Class for working with strings

Class Method Summary collapse

Class Method Details

.complex?(string) ⇒ True, False

Check if string is complex number

Returns:

  • (True, False)

    result of comparison



17
18
19
20
21
# File 'lib/ooxml_parser/helpers/string_helper.rb', line 17

def complex?(string)
  true if Complex(string.tr(',', '.'))
rescue ArgumentError
  false
end

.numeric?(string) ⇒ True, False

This method check if string contains numeric

Returns:

  • (True, False)

    result of comparison



9
10
11
12
13
# File 'lib/ooxml_parser/helpers/string_helper.rb', line 9

def numeric?(string)
  true if Float(string)
rescue ArgumentError
  false
end