How to put a " into a variable.

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

How to put a " into a variable.

Post by Googie85 » Fri Jan 05, 2024 4:10 am

Hi Guys!

I am trying to put a " into a variable. For example:

put " "test" " into tVar

Any advice will be greatly received!

Thanks,

Googie.

wsamples
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 262
Joined: Mon May 18, 2009 4:12 am

Re: How to put a " into a variable.

Post by wsamples » Fri Jan 05, 2024 5:55 am

Code: Select all

put quote & "test" & quote into tvar
See 'quote' and '&' in the dictionary.

Googie85
Posts: 199
Joined: Tue Aug 05, 2014 10:07 am

Re: How to put a " into a variable.

Post by Googie85 » Fri Jan 05, 2024 6:30 am

Thanks for your reply!

It worked! Although I have another similar question. I have the following string:

"Test String"

I need to remove the " and leave the remaining text only.

Many Thanks for any assistance.

Googie.

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to put a " into a variable.

Post by stam » Fri Jan 05, 2024 9:37 am

Googie85 wrote:
Fri Jan 05, 2024 6:30 am
Thanks for your reply!

It worked! Although I have another similar question. I have the following string:

"Test String"

I need to remove the " and leave the remaining text only.

Many Thanks for any assistance.

Googie.
Use replace or replaceText commands.
Look it up in LiveCode's Dictionary or use Google (i.e. search for 'livecode replace command' or some such)

The dictionary should suffice and should always be the first port of call. But it sounds like you may not have tried this...

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9670
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: How to put a " into a variable.

Post by dunbarx » Fri Jan 05, 2024 3:05 pm

What everyone said.

The issue is that "quote" :D is both a character (") that defines text AND a constant ("quote", ASCII 34) :roll: . So in order to be able to add the quote character to a string one must use the constant.

It is easier to understand and use, say, the "return" constant (ASCII 10) when building a multi-line string. One does not hit the return key to do so. But the employment of each is identical.

Craig

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7238
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

Re: How to put a " into a variable.

Post by jacque » Fri Jan 05, 2024 7:24 pm

Googie85 wrote:
Fri Jan 05, 2024 6:30 am
Although I have another similar question. I have the following string:

"Test String"

I need to remove the " and leave the remaining text only
You can also use trueWord:

Code: Select all

put trueword 1 to -1 of tString into tString
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

stam
Posts: 2686
Joined: Sun Jun 04, 2006 9:39 pm
Location: London, UK

Re: How to put a " into a variable.

Post by stam » Fri Jan 05, 2024 7:26 pm

Learn something every day :)

Post Reply

Return to “Android Deployment”