Anonymous user
Word wrap: Difference between revisions
m
→{{header|Elena}}
Line 1,191:
=={{header|Elena}}==
ELENA
<lang elena>import extensions
import system'routines
import extensions'text
"In olden times when wishing still helped one, there lived a king
extension wrapOp
{
wrap(
int currentWidth := 0
^ TokenEnumerator
.new(self)
.selectBy
currentWidth += word
if (currentWidth > lineWidth)
currentWidth := word
^ newLine + word + " "
currentWidth += 1;
^ word + " "
.summarize(
}
public program()
{
console
console
console
console
{{out}}
<pre>
|