change quotation mark in htmltext

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
chrisw
Posts: 11
Joined: Thu Jul 03, 2014 8:45 am

change quotation mark in htmltext

Post by chrisw » Wed Aug 06, 2014 10:27 am

Hi,

can the quotation mark of a text be changed in the htmltext?
e.g. "All is gone" to "- All is gone -"

htmltext:
<p><font face="Shalom Old Style" size="20">"All is gone"</font></p>
to
<p><font face="Shalom Old Style" size="20"> - All is gone - </font></p>

The problem: deleting the quotation marks in the htmltext changes the font, size etc. too!

Kind regards

chrisw

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: change quotation mark in htmltext

Post by Klaus » Wed Aug 06, 2014 12:53 pm

Hi Chris,

sorry, not sure I understand?
The quotes ARE in fact an important part of the HTML, so deleteing them will of course produce rubbish!

But your initial question is NOT about deleting quotes actually!?
e.g. "All is gone" to "- All is gone -"
Would result in:
<p><font face="Shalom Old Style" size="20">"- All is gone -"</font></p>

So you should just replace the TEXT inside of the quotes like this:
...
replace "All is gone" with "- All is gone -" in yourHTMLTextVariableHere
...

Best

Klaus

P.S.
Since this is everything but OFF-TOPIC (Hint, hint 8) ) I will move this thread to the beginners section.

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: change quotation mark in htmltext

Post by MaxV » Fri Aug 08, 2014 3:30 pm

You should use replaceText() function and a good regular expression. :mrgreen:
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

chrisw
Posts: 11
Joined: Thu Jul 03, 2014 8:45 am

Re: change quotation mark in htmltext

Post by chrisw » Sat Aug 09, 2014 8:58 am

MaxV, thanks for the hint. But alas I get a result only when I put

replaceText("Strafgericht","Straf","gut")

into the msg, but not, when I put it into the script (there I get always the message:

field "Field": execution error at line 2 (Handler: can't find handler) near "replaceText", char 1

How I get a result in the script?

Alle the best to You!

chrisw

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: change quotation mark in htmltext

Post by MaxV » Thu Aug 14, 2014 1:35 pm

I don't have a whole picture of your problem, but I think that you have a field "mytext", so you may create a button with this code:

Code: Select all

on MouseUp
put the htmlText of field "myText" into temp
put "> " & quote into tStart
put replaceText(tStart,"> - ", temp) into temp
put  quote & " <" into tEnd
put replaceText(tEnd," - <", temp) into temp
#answer temp #uncomment this to see what happened
set the htmlText of field "mytext" to temp
end MouseUp  
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Klaus
Posts: 14191
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: change quotation mark in htmltext

Post by Klaus » Thu Aug 14, 2014 1:40 pm

Hi Chris,
chrisw wrote:But alas I get a result only when I put: replaceText("Strafgericht","Straf","gut") into the msg, but not, when I put it into the script (there I get always the message:
field "Field": execution error at line 2 (Handler: can't find handler) near "replaceText", char 1
"replacetext()" is a FUNCTION, but you are obviously using it like a HANDLER!

Do something like this:
...
PUT replaceText("Strafgericht","Straf","gut") INTO aVariable
answer aVariable
# or whatever...
...

Best

Klaus

Da_Elf
Posts: 311
Joined: Sun Apr 27, 2014 2:45 am

Re: change quotation mark in htmltext

Post by Da_Elf » Thu Aug 14, 2014 9:41 pm

found this this morning. i saw something about quotation marks in it but havent looked through all the stuff yet was just looking for a return/whitespace remover

http://www.robertcailliau.eu/Alphabetic ... 0Routines/

Post Reply