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
#57095 - 06/03/19 02:54 PM extract words after each space
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 400
Loc: Home
Hi, can someone help me to extract words after each space!

Example of data:

aaa bbbbbbbbbbbb cc
&a = aaa
&b = bbbbbbbbbbbb
&c = cc

Thank you in advance

thanks


Edited by Sami786 (06/03/19 02:54 PM)
_________________________
Peace

Top
#57096 - 06/03/19 03:02 PM Re: extract words after each space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 400
Loc: Home
I tried below code but it's not working

define(&i,integer,0)
define(&curLine, string, '')
&curLine := trimright(@(176,1,22))
search(&curLine,' ')
&FieldsArray[&i] := &curLine
&a := &i+1
&b := &i+2
&c := &i+3
endsearch()
_________________________
Peace

Top
#57097 - 06/03/19 04:14 PM Re: extract words after each space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 400
Loc: Home
anyone ???
_________________________
Peace

Top
#57098 - 06/03/19 04:41 PM Re: extract words after each space [Re: Sami786]
jouberto Offline
OL Toddler

Registered: 04/18/18
Posts: 50
Hi Sami,

This PlanetPress community forum has no guarantee in terms of response times. Your posts could remain unanswered for days(though this practically never happens). If you need urgent assistance, please work with technical support or professional services.

For this particular case, you're doing things in the wrong order. You will want to put your "&a/&b/&c" assignations outside the Search loop. Inside the Search should be only your array building and the incrementation of your array index (&i:=&i+1).
Then once the Search loop is done, you will still want to do one last assignation to your array because the last results of the Search is accessible only after the Search loop code. Then you will simply do &a:=&FieldsArray[x],&b:=&FieldsArray[y] etc...pointing only on the specific fieldArray indexes you need for these variables.

If you always have a static amount of words to extract, and a static amount of words in your paragraph, then the Search loop is not required and this is overkill. If there could be any number of words in your paragraph, then the Search loop is good, but then you will not be able to point on static index positions from your FieldsArray to populate a-b and c...I feel this post is missing information/context so we can properly guide you.

Hope this still helps get the expected result.

Top
#57101 - 06/04/19 05:16 PM Re: extract words after each space [Re: Sami786]
Sami786 Offline
OL Expert

Registered: 01/29/14
Posts: 400
Loc: Home
Hi Jouberto, thank you for the advice, I needed this urgently and thought someone may have the answer! But I do respect the way forum works.

There are always a number of 3 static words, like my example!
example: aaa bbbbbbbbbbb cc

I'll try your suggestion and I'm sure that will work. thank you once again.

THANKS


Edited by Sami786 (06/04/19 05:28 PM)
_________________________
Peace

Top