Page 1 of 1
How to put a " into a variable.
Posted: Fri Jan 05, 2024 4:10 am
by Googie85
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.
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 5:55 am
by wsamples
Code: Select all
put quote & "test" & quote into tvar
See 'quote' and '&' in the dictionary.
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 6:30 am
by Googie85
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.
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 9:37 am
by stam
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...
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 3:05 pm
by dunbarx
What everyone said.
The issue is that "quote"
is both a character (") that defines text AND a constant ("quote", ASCII 34)
. 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
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 7:24 pm
by jacque
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
Re: How to put a " into a variable.
Posted: Fri Jan 05, 2024 7:26 pm
by stam
Learn something every day