Skip to content

threedaymonk/detabulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Detabulator

Extract columnar data from tabulated fixed-width text.

Example

Given some tabulated data:

sample = <<END
            Column 1    Column 2
Drinks      Beer        Whiskey
Not drinks  Toothpaste  Mouthwash
END

This:

require "detabulator"
Detabulator.new.detabulate(sample)

Will produce this:

[["", "Column 1", "Column 2"],
 ["Drinks", "Beer", "Whiskey"],
 ["Not drinks", "Toothpaste", "Mouthwash"]] 

This is just a first release that does something useful.

Limitations

  • Double-width characters (e.g. Japanese) are not handled correctly.
  • Combining diacritics are not handled correctly.
  • When one cell contains much longer text and a space, an extra column is generated.

About

Extract columnar data from tabulated fixed-width text

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages