[Tex/LaTex] Wrapping long lines that contain no spaces

line-breakingmacros

I need to format extremely long strings of text. I would like to be able to specify their width, and have them wrap, with or without some special symbol to indicate that the line is wrapped. The problem is, however, that these strings do not contain any spaces. Here's an example of what I would like:

\foo{2in}
{17823941237490812347123904712389407123408917234890123748912034712985712389012351}

So I would like to get an hbox containing this long number, but spanning several lines, so that I get a rectangle 2in wide.

Does anyone know of a package/trick/macro that does this?

Best Answer

You may try the seqsplit package.