Page 1 of 1

convert list to string

Posted: Sat Mar 07, 2020 2:18 am
by paulalsmith1000
Hi there (me again)

This really is straight forward, but its late and I'm stumped??!! so any help appreciated.

I have a list field where you can select more than one line (containing names),

if I put the selected text from the field into a variable and put it, I can see that each entry is on a separate line (understandably),

but I need these names as a string; name1, name2, name3, etc... because I need to use them in a POST request.

Could you tell me the best way to do this?

Kind regards

Paul

Re: convert list to string

Posted: Sat Mar 07, 2020 3:39 am
by FourthWorld
To turn this:

Code: Select all

Bob
Carol
Ted
Alice
...into this:

Code: Select all

Bob,Carol,Ted,Alice
...use:

Code: Select all

replace cr with comma in tList

Re: convert list to string

Posted: Sat Mar 07, 2020 11:25 am
by Klaus
FourthWorld wrote:
Sat Mar 07, 2020 3:39 am

Code: Select all

replace cr with comma in tList
Yep, this is not SPARTA, but Livecode! :-)

Re: convert list to string

Posted: Sat Mar 07, 2020 2:46 pm
by SparkOut
You know Ted and Alice are not together any more, don't you? They split a few months ago, and he started seeing Caitlin recently. Alice got a new job and moved away, I think.

Re: convert list to string

Posted: Sat Mar 07, 2020 4:20 pm
by Klaus
OK, OK, my posting was a bit off the track, but at least I mentioned Livecode! :-D

Re: convert list to string

Posted: Sat Mar 07, 2020 9:13 pm
by SparkOut
Oops yes, this should have been in the gossip forum :oops:
Luckily I didn't mention Kaveh :wink:

Re: convert list to string

Posted: Sat Mar 07, 2020 9:18 pm
by bogs
SparkOut wrote:
Sat Mar 07, 2020 9:13 pm
Luckily I didn't mention Kaveh
Silly me, and here I thought 'Alice' was the code name we were using this week... :P

Re: convert list to string

Posted: Sun Mar 08, 2020 4:55 pm
by paulalsmith1000
thanks v much as ever

kind regards

Paul