04-15-2024, 06:43 AM
Not very 'fisticated, but this works:
Code: (Select All)
text$ = "Four score and seven years ago our fathers brought forth on this continent, a new nation, conceived in Liberty, and dedicated to the proposition that all men are created equal."
text$ = text$ + " " ' add space at end to catch remnant of text
LineStart = 1 ' set linelength to be 40
Print String$(40, "-") ' reference 40 char string
LineEnd = LineStart + 39 ' LineEnd is 40
FindSpace:
Ch$ = Mid$(text$, LineEnd + 1, 1)
If Ch$ <> " " Then ' Ch$ is character after LineEnd
LineEnd = LineEnd - 1 ' if it's NOT a space, move LineEnd left until it IS
GoTo FindSpace
End If
Print Mid$(text$, LineStart, LineEnd - LineStart + 1) ' print line from linestart to lineend
LineStart = LineEnd + 2
If Mid$(text$, LineStart + 1, 1) = " " Then ' if char after end is a space (it's not)
LineStart = LineStart + 1 ' step past it for new LineStart position
End If
LineEnd = LineEnd + 40
If LineStart >= Len(text$) Then Sleep
GoTo FindSpace ' go again if not at end of text
Of all the places on Earth, and all the planets in the Universe, I'd rather live here (Perth, Western Australia.) 
Please visit my Website at: http://oldendayskids.blogspot.com/

Please visit my Website at: http://oldendayskids.blogspot.com/

