Quotation Marks help

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Nomi
Posts: 19
Joined: Wed Feb 27, 2008 4:08 pm

Quotation Marks help

Post by Nomi » Fri Apr 18, 2008 9:08 pm

I'm trying to add the following line to a text file:

<?xml version="1.0" encoding="UTF-8"?>

As you see, there are double quotes in the line. How do I get Revolution to add those quotes?

if I do

put "<?xml version="1.0" encoding="UTF-8"?>" into variable the double quotes cause issues.

I looked at the docs and on the forum, didn't find a solution.

- Noel

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1239
Joined: Sat Apr 08, 2006 1:10 pm
Contact:

Re: Quotation Marks help

Post by BvG » Fri Apr 18, 2008 10:11 pm

Nomi wrote:put "<?xml version="1.0" encoding="UTF-8"?>
try "quote":

Code: Select all

put "<?xml version=" & quote & "1.0" & quote & "encoding=" & quote & "UTF-8" & quote & "?>"
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

Nonsanity
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 86
Joined: Thu May 17, 2007 9:15 pm
Contact:

Post by Nonsanity » Fri Apr 18, 2008 10:32 pm

When doing it that way, I find it's a little less wordy to define:

put quote into q
put "Then he said, "&q&"Howdy, pardner!"&q&" and skipped away..." into msg

Still ugly, but down to just 4 extra characters per quote. There's also the function (gah! its name escapes me!) that will parse in-line variables.

function_name_i_forgot( "So I said, [q]Howdy yerself![q] and ignored him." )
~ Nonsanity
~ Chris Innanen

Nomi
Posts: 19
Joined: Wed Feb 27, 2008 4:08 pm

Post by Nomi » Fri Apr 18, 2008 11:47 pm

Ok, tried

put "<?xml version=" & quote & "1.0" & quote & "encoding=" & quote & "UTF-8" & quote & "?>" in URL "file:world_locations.cfg"

Which looks right to me, however when I try to run the program I am receiving the error message:

Handler: can't find handler
Write Config
Line hint is the above line

I'll admit I'm fairly new to Runtime, but everything seems right to me. Any ideas?

- Noel

Nomi
Posts: 19
Joined: Wed Feb 27, 2008 4:08 pm

Post by Nomi » Fri Apr 18, 2008 11:51 pm

Nevermind! Solved it. One of those headslap errors.

I used the wording in URL instead of into URL

I love programming! :)

- Noel

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10043
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Post by FourthWorld » Sat Apr 19, 2008 3:52 am

I use the q function, from stdLib.rev:

Code: Select all

put "He said, "&q("Hello")&"."  -- produces:   He said, "Hello".

function q s
  return quote&s&quote
end q
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply