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: Klaus, FourthWorld, heatherlaine, kevinmiller

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

convert list to string

Post by paulalsmith1000 » Sat Mar 07, 2020 2:18 am

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: 7937
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: convert list to string

Post by FourthWorld » Sat Mar 07, 2020 3:39 am

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
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Klaus
Posts: 11959
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: convert list to string

Post by Klaus » Sat Mar 07, 2020 11:25 am

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: 2289
Joined: Sun Sep 23, 2007 4:58 pm

Re: convert list to string

Post by SparkOut » Sat Mar 07, 2020 2:46 pm

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: 11959
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: convert list to string

Post by Klaus » Sat Mar 07, 2020 4:20 pm

OK, OK, my posting was a bit off the track, but at least I mentioned Livecode! :-D

SparkOut
Posts: 2289
Joined: Sun Sep 23, 2007 4:58 pm

Re: convert list to string

Post by SparkOut » Sat Mar 07, 2020 9:13 pm

Oops yes, this should have been in the gossip forum :oops:
Luckily I didn't mention Kaveh :wink:

bogs
Posts: 4790
Joined: Sat Feb 25, 2017 10:45 pm

Re: convert list to string

Post by bogs » Sat Mar 07, 2020 9:18 pm

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: 52
Joined: Sat Jun 15, 2019 10:09 am

Re: convert list to string

Post by paulalsmith1000 » Sun Mar 08, 2020 4:55 pm

thanks v much as ever

kind regards

Paul

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”