Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Split to the same string length

text = "1234567890123"
width = 3
# (0..text.size).step(width) {|start|
#    puts text[start, width]
# }

res = ((0..text.size).step(width).map { |start| text[start, width] }).join " "
puts res