• Teaser Home

    Clean Code Developer School

    Saubere Softwareentwicklung üben – regelmäßig, fokussiert, individuell, angeleitet

Wordwrap

Application Kata „Wordwrap“

Write an application that rearranges a text so that lines are wrapped at a given column width.

The following illustration shows how the application may look like.

1

The user will enter the text into a textbox. Furthermore the user gives the number of characters per line. The example shows 25 characters as the new line length. Clicking the Wrap button wraps the text. The result is shown in the lower textbox.

Variation #1

The program can be written as a command line application. Filename and width oft he wrapped text are given as command line parameters:

Variation #2

Integrate a hyphenation library like NHunspell [1] to split words into syllables.

Resources

[1] http://nhunspell.sourceforge.net/