RosettaCodeData/Task/Word-wrap/NetRexx/word-wrap-2.netrexx

29 lines
709 B
Text
Raw Permalink Normal View History

2013-10-27 22:24:23 +00:00
/* 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