Quote:
> Anyone know how I can strip characters out of string before printing it?
> The string will be something like "(402)123456787890" and I want to be
> able to strip out the open and close brackets.
Thanks for the suggestions. The 'token' method was an interesting one which
I must try and remember. Unfortunately I couldn't that methos because there
could be an indeterminate number of brackets in the string.
However, I took the plunge and managed to figure it out using 'get' and
'put'.
The original code had the following line at the beginning of the proc in
question:
/msg exch def
Which I replaced with the following code:
/humantext exch def
/msgtemp humantext length string def
/msgidx 0 def
humantext
{ dup dup
40 ne exch 41 ne and
{ msgtemp exch msgidx exch put
/msgidx msgidx 1 add def }
{ pop } ifelse
} forall
/msg msgtemp 0 msgidx 1 sub getinterval def
Seems to do the trick. If anyone can suggest any improvements then be my
guest.
BTW, if anyone is interested in why I needed this, it's for printing
barcodes along with their human-readable equivalent. We need the brackets
in the human readable text under the barcode, but the barcode itself cannot
contain them.
Cheers,
Duncan Kinnear.