convert list to string

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
paulalsmith1000
Posts: 58
Joined: Sat Jun 15, 2019 10:09 am

convert list to string

Post 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
FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10103
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: convert list to string

Post 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
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: convert list to string

Post 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! :-)
SparkOut
Posts: 2984
Joined: Sun Sep 23, 2007 4:58 pm

Re: convert list to string

Post 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.
Klaus
Posts: 14324
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: convert list to string

Post by Klaus »

OK, OK, my posting was a bit off the track, but at least I mentioned Livecode! :-D
SparkOut
Posts: 2984
Joined: Sun Sep 23, 2007 4:58 pm

Re: convert list to string

Post by SparkOut »

Oops yes, this should have been in the gossip forum :oops:
Luckily I didn't mention Kaveh :wink:
bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: convert list to string

Post 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
Image
paulalsmith1000
Posts: 58
Joined: Sat Jun 15, 2019 10:09 am

Re: convert list to string

Post by paulalsmith1000 »

thanks v much as ever

kind regards

Paul
Post Reply