Word wrap: Difference between revisions
Content added Content deleted
No edit summary |
|||
Line 2,777: | Line 2,777: | ||
she took a golden ball, and threw it up on high and caught it, and this ball was |
she took a golden ball, and threw it up on high and caught it, and this ball was |
||
her favorite plaything.</pre> |
her favorite plaything.</pre> |
||
=={{header|MiniScript}}== |
|||
<lang MiniScript>str = "one two three four five six seven eight nine ten eleven!" |
|||
width = 15 |
|||
words = str.split |
|||
pos = 0 |
|||
line = "" |
|||
for word in words |
|||
pos = pos + word.len + 1 |
|||
if pos <= width then |
|||
line = line + word + " " |
|||
else |
|||
print line[:-1] |
|||
line = word + " " |
|||
pos = word.len |
|||
end if |
|||
end for |
|||
print line[:-1]</lang> |
|||
{{out}} |
|||
<pre> |
|||
one two three |
|||
four five six |
|||
seven eight |
|||
nine ten |
|||
eleven! |
|||
</pre> |
|||