Skip to main content
2 of 3
improved formatting
Neil
  • 177.3k
  • 12
  • 74
  • 281

JavaScript (ES6), 148 bytes

s=>(s=' 0123456789ABCDEF'+s+' '.repeat(15)).match(/(?!^).{16}/g).map((t,i)=>d+`+
| `+[s[i],...t].join` | `,d=`+---`.repeat(17)).join` |
`+` |
${d}+`

The ' 0123456789ABCDEF' exists to populate the first column, but conveniently also covers the first row. The input string is then padded with spaces to allow it to be split into substrings of length 16, with the (?|^) preventing the leading space from being matched. The rest is just joining up the pieces.

Neil
  • 177.3k
  • 12
  • 74
  • 281