IMPORTANT ANNOUNCEMENT

These forums were permanently set to read-only mode on July 20, 2022. From that day onwards, no new posting or comment is allowed on the site, but the historical content remains intact and searchable.

A new location for posting questions about PlanetPress Suite is now available:

OL Learn - PlanetPress Classic (opens in new tab)

Topic Options
#58288 - 06/24/22 07:15 AM removing characters from a data string
Justin_c Offline
OL Newbie

Registered: 06/23/22
Posts: 1
hello all. I'm having an issue removing a set of characters from a string that is being passed in a csv file. I'm passing identifiers in the csv file that will do specific actions but I'm having an issue to get everything to work. Currently this is bolding and italicizing and line breaking but the '~' are still showing. would someone tell me what I am doing wrong?

<b> = bold
<i> = italic
~ = line break

This is the code im using:
define(&i, integer, 0)
define(&j, integer, 0)
define(&s, string, '')
define(&st, string, '')

% Put your variable text in the &s variable.
&s := @(176,1,4000) + '~'
&st := ''

for(&i,1,1,length(&s))
% Check if we enter a tag.
if(mid(&s, &i, 1) = '<')
&j := &i
&st := ''
repeat
&st := &st + mid(&s, &j, 1)
&j := &j + 1
until(mid(&s, &j, 1) = '>')
&st := &st + '>'
&i := &j + 1
endif()

% Handle the different styles.
if((&st = '</b>') or (&st = '</i>'))
setstyleext(&Default, 11.00,0,[100],100)
endif()
if(&st = '<b>')
setstyleext(&bold, 11.00,0,[100],100)
endif()
if(&st = '<i>')
setstyleext(&italic, 11.00,0,[100],100)
endif()
if((mid(&s, &i, 1) = '~'))
crlf(.3)
endif()

% Show the text.
show(mid(&s, &i, 1))


% Handle moving to next line if the line is longer
% than a certain value(by default 4.0 inches long,
% replace it with whatever you need).
if((mid(&s, &i, 1) = ' ') and (&current.x >= 6.45))
crlf()
endif()
endfor()

crlf(.5)
&s := @(177,1,4000) + '~'

search(&s, '~')
beginparagraph(0,7,0,'leftright',0.01)
setstyleext(&Default,11.00,0,[100],100)
show(&s)
endparagraph()
if(&sig_image)
crlf(.05)
$picture11
crlf(.15)
else
crlf()
endif
endsearch()

&obj_height := &physical.y

Top
#58290 - 06/25/22 08:27 AM Re: removing characters from a data string [Re: Justin_c]
Jean-Cédric Offline
OL Expert

Registered: 10/03/16
Posts: 681
Loc: Québec, Canada
You are showing the content of &s outside of your Search() function as in the below code.

% Show the text.
show(mid(&s, &i, 1))
_________________________
♪♫♪♫
99 frigging bugs in my code
99 frigging bugs
Take one down
Code around
127 frigging bugs in my code
♪♫♪♫

Top