Word wrap: Difference between revisions

Content added Content deleted
(→‎{{header|Ada}}: Added Ada version)
Line 136: Line 136:


Output, set to 72 lines (with input picked by cut-and-paste from the task description):
Output, set to 72 lines (with input picked by cut-and-paste from the task description):


<pre>Even today, with proportional fonts and complex layouts, there are still
<pre>Even today, with proportional fonts and complex layouts, there are still
cases where you need to wrap text at a specified column. The basic task
cases where you need to wrap text at a specified column. The basic task
Line 157: Line 155:
the two algorithms give different results.</pre>
the two algorithms give different results.</pre>


Note that this solution properly deals with multi-paragraph inputs.
For the extra credit, one could derive a class Word_Wrap.Advanced from Word_Wrap.Basic.
For more sophisticated algorithms (the extra credit), one could derive
a class Word_Wrap.<something> from Word_Wrap.Basic.


=={{header|AWK}}==
=={{header|AWK}}==