Word wrap: Difference between revisions

(→‎version 2: use lastpos bif)
(→‎{{header|NetRexx}}: add Version 2)
Line 1,143:
 
=={{header|NetRexx}}==
===version 1===
<lang NetRexx>/* NetRexx */
options replace format comments java crossref symbols
Line 1,240 ⟶ 1,241:
Out, out, brief candle! Life's but a walking shadow, a poor player That struts and frets his hour upon the stage And then is heard
no more. It is a tale Told by an idiot, full of sound and fury Signifying nothing. —-Macbeth (Act 5, Scene 5, lines 17-28)</pre>
 
===version 2===
<lang NetRexx>/* NetRexx ************************************************************
* 23.08.2013 Walter Pachl translated from REXX version 2
**********************************************************************/
options replace format comments java crossref symbols
 
runSample(arg)
 
method runSample(arg) public static
s='She should have died hereafter;' -
'There would have been a time for such a word.' -
'Tomorrow, and tomorrow, and tomorrow, and so on'
w=72
Say s.length
loop while s>' '
Loop i=w+1 to 1 by -1
If s.substr(i,1)='' Then
Leave
End
If i=0 Then
p=s.pos(' ')
Else
p=i
say s.left(p)
s=s.substr(p+1)
End
If s>'' Then
say s
return</lang>
 
=={{header|OCaml}}==
2,295

edits