string into array

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

string into array

Pierre Yelle
Can anyone point out what is wrong in the following ??




var:'list1' ='aaa***bbb***ccc***ddd***eee***fff';

var:'List2' = $list1->(split:'***');


results

(aaa)


Standard Edition 8.5.1b4




Pierre


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: string into array

Mark Palmer
I dropped your code into a page with [] around it and it returned

array: (aaa), (bbb), (ccc), (ddd), (eee), (fff)

Lasso 8.5.1fc1 on OS X 10.4.7

On 31 Aug 2006, at 20:31, Pierre Yelle wrote:

> var:'list1' ='aaa***bbb***ccc***ddd***eee***fff';
>
> var:'List2' = $list1->(split:'***');



Regards

Mark Palmer
E: [hidden email]
T: 01902 620500
W: www.pageworks.co.uk





------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: string into array

Pierre Yelle
Thanks Mark

The values are in there as I can use them in subsequent inlines, but it
will not report the vars  ???


I am using a redirect with ... &x1=' + $List2 ...


Page throws no error but will not report any lasso vars after reporting
the first position of the array   ??


John at pointinspace will probably update as soon as the final
candidate is official release.


THanks again
Pierre


On 31-Aug-06, at 12:57 PM, Mark Palmer wrote:

> I dropped your code into a page with [] around it and it returned
>
> array: (aaa), (bbb), (ccc), (ddd), (eee), (fff)
>
> Lasso 8.5.1fc1 on OS X 10.4.7
>
> On 31 Aug 2006, at 20:31, Pierre Yelle wrote:
>
>> var:'list1' ='aaa***bbb***ccc***ddd***eee***fff';
>>
>> var:'List2' = $list1->(split:'***');
>
>
>
> Regards
>
> Mark Palmer
> E: [hidden email]
> T: 01902 620500
> W: www.pageworks.co.uk
>
>
>
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:  
> http://www.listsearch.com/lassotalk.lasso?manage
>
>





Pierre


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: string into array

Bil Corry-3
Pierre Yelle wrote:
> I am using a redirect with ... &x1=' + $List2 ...

$List2 will contain spaces, which must be encoded to be used in an URL.  So you would need to do this:

  &x1=' + (encode_stricturl:$List2) + ...

But what are you trying to do?  Pass the values as an array?  Because that will pass them as a string output of an array.  Instead, you could pass your original string, then ->split it on the receiving page.


- Bil



------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: string into array

Pierre Yelle
Hi Bil,

thanks for this answer.

Working with pageblocks, a .lgc page shows nothing even if I abort it
to check stuff.
I was redirecting with the values and simply checking the vars before
coding the rest of the page ...
... an iterate using the array.
I wanted to see what the values looked like before doing a multiple
insert.


I had simply skipped the checking part and carried on...



The product ids (the array in question) do contain _ - and spaces.

I'll encode_stricturl the vars in the future and split arrays in the
checking page.
This page only serves during developpement.
Your email will make it much more useful.



Thanks

Pierre


On 31-Aug-06, at 4:44 PM, Bil Corry wrote:

> Pierre Yelle wrote:
>> I am using a redirect with ... &x1=' + $List2 ...
>
> $List2 will contain spaces, which must be encoded to be used in an
> URL.  So you would need to do this:
>
>  &x1=' + (encode_stricturl:$List2) + ...
>
> But what are you trying to do?  Pass the values as an array?  Because
> that will pass them as a string output of an array.  Instead, you
> could pass your original string, then ->split it on the receiving
> page.
>
>
> - Bil
>
>
>
> ------------------------------
> Lasso Support: http://support.omnipilot.com/
> Search the list archives: http://www.listsearch.com/lassotalk.lasso
> Manage your list subscription:  
> http://www.listsearch.com/lassotalk.lasso?manage
>
>





Pierre


------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage