Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to extract all items starting with 1 from a string array

Status
Not open for further replies.

japeconsulting

Programmer
Jan 12, 2005
7
GB
Hi

I have a array string that contains a number of notes from a field in the database and I want to extract specific items from this string. For example the string contains:

stringvar array test:=["/1ItemA","/2ItemB","/1ItemC"];

I want a new string field (not array) that contains all the items starting with /1 from the array

Help please

Thanks
Jackie
 
You need to loop through the array using a variable counter:

stringvar array test;
numbervar x := 1;
stringvar display;

while x <= ubound(test)
do
(display := display + ", " + test[x];
x := x + 1);

mid(display,2)

I'm using mid to strip off the first comma.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top