Code: Select all
For n=1 To 52
s$+Chr(Random(90,65))
Next
o$=s$
crop=5
While Len(s$)>crop
c$+Left(s$,crop)+#CRLF$
s$=Mid(s$,crop+1)
Wend
If s$
c$+s$
EndIf
MessageRequester("Result","Original:"+#LF$+o$+#LF$+#LF$+"Cropped:"+#LF$+c$)
Code: Select all
#SOC=SizeOf(Character)
Procedure.s SplitTextIntoEvenLines(text$,length=100)
*i.Character=@text$
*o.Character=AllocateMemory(StringByteLength(text$)+Len(text$)*(2*SizeOf(Character)),#PB_Memory_NoClear)
*o_orig=*o
max=length+1
While *i\c
n+1
If n=max
PokeS(*o,#CRLF$)
*o+2*#SOC
n=0
Else
*o\c=*i\c
*o+#SOC
*i+#SOC
EndIf
Wend
text$=PeekS(*o_orig)
FreeMemory(*o_orig)
ProcedureReturn text$
EndProcedure
For n=1 To 52
s$+Chr(Random(90,65))
Next
MessageRequester("Result","Original:"+#LF$+s$+#LF$+#LF$+"Cropped:"+#LF$+SplitTextIntoEvenLines(s$,5))

