Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/ext_string.rb
Instance Method Summary collapse
Instance Method Details
#to_excel_col ⇒ Object
3 4 5 6 7 8 9 10 11 |
# File 'lib/ext_string.rb', line 3 def to_excel_col alphabet = ('A'..'Z').to_a col = 0 letters = self.split(//).reverse letters.each_index do |power| col += (26 ** power) * (alphabet.index(letters[power]) + 1) end col end |