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
#19056 - 01/22/07 01:10 PM splitting data in a script
Van Offline
OL Newbie

Registered: 06/26/06
Posts: 21
Loc: Texas
Hi,

I have a string that needs to be split into 3 parts, city, state and zip.

Mycity, ST 12345
Yourcity, TS 12345-6789

I need each to be in a separate variable.

Any help would be great

Top
#19057 - 01/23/07 09:45 AM Re: splitting data in a script
Anonymous
Unregistered


Hello,


Here an example of how to work with PressTalk object.

- Just create a new document add your data (I used both lines you provided - 2 lines per pages)

Paste the following, you will understand the logic and you will be able to use it for your project.
Note that PressTalk could be used under and advance data selection or anywhere it allows you.

%Define the variables
define(&lInitialString,string,trim(@(2,1,23)))
define(&lLeftPortionStr,string,'')
define(&lLeftPortionStr2,string,'')

Show(&lInitialString)
crlf

%Look for the coma an extract the left portion
&lLeftPortionStr:=left(&lInitialString,pos(',',&lInitialString)-1)
crlf
Show(&lLeftPortionStr)


%New value of the initial string minus the left portion
crlf
crlf
&lInitialString:=mid(&lInitialString,pos(',',&lInitialString)+2,length(&lInitialString))
show(&lInitialString)


%Look for the space charactere
&lLeftPortionStr2:=mid(&lInitialString,pos(' ',&lInitialString)+1,length(&lInitialString))

crlf
show(&lLeftPortionStr2)

%New value of the initial string
&lInitialString:=&lLeftPortionStr2

Top