View previous topic :: View next topic
|
Author |
Message |
ssprabhu
New User
Joined: 25 Apr 2005 Posts: 67 Location: pune
|
|
|
|
i need to split a max 1500 bytes descriptioon to 32 bytes split like if the description has 1280 bytes i need to write in to 40 records ..32 records each..i.e., 32*40 = 1280 bytes..
and i need to find the space , comma , full stop before writing in to the next record ...
Plz post if u have any logic or functions which makes it easy....
Thanks..
sukumar |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
probably the best approach would be to use the reference modification..
for the full stop the issue is clear
if the long variable contains ... wwww. sssss. rrrr.
build 3 records and get rid of the inital blank after the full stop
Code: |
12345678901234567890123456789012
wwww.
sssss.
rrrr. |
the comma and space issues are not very clear
please show more details for the process |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you post some sample input showing all of the conditions that might need to be handled and the output from that sample input. . .
What should happen to a comma followed by a space? A double space? And on. . .
Along with the data, you need to post the rules for getting from the input to the output. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
|
|
I guess it's a long text that he wants to display or print in a 32char wide area, but no splitting of words is allowed.
something like this maybe
Code: |
move 1 to startpos
move 1 to ixl
perform until startpos > length(str) or str(starpost:) = spaces
move 32 to len
perform until str(startpos+len:1) = ' ' or ',' or '.' or len=0
subtract 1 from len
end-perform
if len=0 then move 32 to len end-if
move str(startpos:len) to line(ixl)
add 1 to ixl
compute startpos=startpos + len + 1
end-perform |
|
|
Back to top |
|
|
|