answer "<anything>1234</anything>" is just 1234 ?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
answer "<anything>1234</anything>" is just 1234 ?
WHY?...
put "<anything>1234</anything>"
-- result:
-- <anything>1234</anything>
-------
answer "<anything>1234</anything>"
-- result:
-- 1234
put "<anything>1234</anything>"
-- result:
-- <anything>1234</anything>
-------
answer "<anything>1234</anything>"
-- result:
-- 1234
Re: answer "<anything>1234</anything>" is just 1234 ?
I'm programming a utility to generate KML code and I need to check items with"<" and">" signs and I could use to use the "answer" command but I don't seem to get the answer I need.
Anyway, I'll find another system.
Thank you very much.
Anyway, I'll find another system.
Thank you very much.
-
- Livecode Opensource Backer
- Posts: 9359
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: answer "<anything>1234</anything>" is just 1234 ?
I wonder if you are not jumping too quickly.I'll find another system.
I had never heard of 'KML code' until I saw your post: but a quick look here:
https://developers.google.com/kml/documentation/kml_tut
was instructive.
NOW: for starters: if you use a PUT statement, anything
you put inside double quotes will be PUT.
So, that is not going to work.
KML looks a lot like HTML, so there is no question of 'anything' being put between < and > signs,
just a few possible words and forward slashes.
What is also NOT clear from your postings is whether you are trying to GENERATE KML code
or something else because your example makes me think you are trying to strip KML code of
its markup symbols and end up with JUST the content in an unstyled context.
Code: Select all
on mouseUp
put fld "KML" into fld "CLEAN"
put 1 into KOUNT
repeat until line KOUNT of fld "fREMOVES" is empty
put line KOUNT of fld "fREMOVES" into XXXX
replace XXXX with " " in field "CLEAN"
add 1 to KOUNT
end repeat
end mouseUp
Last edited by richmond62 on Mon Apr 09, 2018 10:18 pm, edited 1 time in total.
-
- Livecode Staff Member
- Posts: 192
- Joined: Thu Apr 18, 2013 2:48 pm
Re: answer "<anything>1234</anything>" is just 1234 ?
The field displayed in the answer dialog uses html text (so you can do
And get bold text in the answer dialog. Your tags are being interpreted as html. If you want to use the answer dialog, perhaps use the following instead:
and then do
instead of .
That way you can also keep your logging statements in and change the implementation when you no longer need an answer dialog to pop up.
Code: Select all
answer "<b>This is bold!</b>"
Code: Select all
command log pValue
answer escape(pValue)
end log
function escape pValue
replace "<" with "<" in pValue
replace ">" with ">" in pValue
return pValue
end escape
Code: Select all
log "<anything>1234</anything>"
Code: Select all
answer "<anything>1234</anything>"
That way you can also keep your logging statements in and change the implementation when you no longer need an answer dialog to pop up.
-
- VIP Livecode Opensource Backer
- Posts: 9648
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: answer "<anything>1234</anything>" is just 1234 ?
Do you see what Richmond is saying?
"Put" is as he stated. Just verbatim strings.
"Answer" evaluates the argument first, and then puts the "result" of that processing into a dialog. It works similarly to parameter passing and certain other LC commands and functions. Anyway, just so you do not see this as a mystery, the "KML" business notwithstanding
Craig Newman
"Put" is as he stated. Just verbatim strings.
"Answer" evaluates the argument first, and then puts the "result" of that processing into a dialog. It works similarly to parameter passing and certain other LC commands and functions. Anyway, just so you do not see this as a mystery, the "KML" business notwithstanding
Craig Newman
Re: answer "<anything>1234</anything>" is just 1234 ?
Thank you, richmond62
I use KML to create virtual flights with Google Earth and I need to create and control elements similar to these:
<longitude>-2.928917744688542</longitude>
<latitude>43.26654581195621</latitude>
<altitude>14</altitude>
<heading>44</heading>
<tilt>82</tilt>
<range>10</range>
<altitudeMode>absolute</altitudeMode>
- - - -
This is a small fragment of my LiveCode application:
put "duration" into elTag
put cogeValTag1Eve (elTag, rp2, eve) into valor /*goes to a funtction*/
put "<" & elTag & ">" & valor & "</" & elTag & ">" into tg
/* This is the part that doesn't work, but it's not fatal either. I'll use another method.: */
answer tg with "parar" or "seguir"; if it is "parar" then exit to top
- - - -
The funny thing is that the command 'answer' doesn't seem to respond as expected if it includes characters like '</'.
I repeat my thanks.
I use KML to create virtual flights with Google Earth and I need to create and control elements similar to these:
<longitude>-2.928917744688542</longitude>
<latitude>43.26654581195621</latitude>
<altitude>14</altitude>
<heading>44</heading>
<tilt>82</tilt>
<range>10</range>
<altitudeMode>absolute</altitudeMode>
- - - -
This is a small fragment of my LiveCode application:
put "duration" into elTag
put cogeValTag1Eve (elTag, rp2, eve) into valor /*goes to a funtction*/
put "<" & elTag & ">" & valor & "</" & elTag & ">" into tg
/* This is the part that doesn't work, but it's not fatal either. I'll use another method.: */
answer tg with "parar" or "seguir"; if it is "parar" then exit to top
- - - -
The funny thing is that the command 'answer' doesn't seem to respond as expected if it includes characters like '</'.
I repeat my thanks.
Re: answer "<anything>1234</anything>" is just 1234 ?
Oops, I just saw the answers from dunbarx and livecodeali.
Thank you very much.
Thank you very much.