A Word Wrapping Technique
Example 14 - Rating: specific
Example 14 - Rating: specific
The Things that Make Up this Example | To Execute this Example |
This function demonstrates how the user can type unwrapped text and when the Enter key is pressed, the text is displayed wrapped. The program can be easily modified to accept any input text width and any output text width.
.
Notes and suggestions
In this example the length to wrap must be between 20 and 75. Examples of output for different wrap lengths are:
Output 1:
Length to wrap 063
Wrapped Text
One two three four five six seven eight nine ten eleven twelve
thirteen fourteen fifteen sixteen seventeen eighteen nineteen
twenty twenty one twenty two twenty three.
Output 2:
Length to wrap 021
Wrapped Text
One two three four
five six seven eight
nine ten eleven
twelve thirteen
fourteen fifteen
sixteen seventeen
eighteen nineteen
twenty twenty one
twenty two twenty
three.
Output 3:
Length to wrap 030
Wrapped Text
One two three four five six
seven eight nine ten eleven
twelve thirteen fourteen
fifteen sixteen seventeen
eighteen nineteen twenty
twenty one twenty two twenty
three.
Keywords
.
Notes and suggestions
In this example the length to wrap must be between 20 and 75. Examples of output for different wrap lengths are:
Output 1:
Length to wrap 063
Wrapped Text
One two three four five six seven eight nine ten eleven twelve
thirteen fourteen fifteen sixteen seventeen eighteen nineteen
twenty twenty one twenty two twenty three.
Output 2:
Length to wrap 021
Wrapped Text
One two three four
five six seven eight
nine ten eleven
twelve thirteen
fourteen fifteen
sixteen seventeen
eighteen nineteen
twenty twenty one
twenty two twenty
three.
Output 3:
Length to wrap 030
Wrapped Text
One two three four five six
seven eight nine ten eleven
twelve thirteen fourteen
fifteen sixteen seventeen
eighteen nineteen twenty
twenty one twenty two twenty
three.
Keywords
Word Wrap | Automatic Tab |
Example 14 |