How to manage a string from a field?

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
ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

How to manage a string from a field?

Post by ale870 » Wed Mar 18, 2009 10:51 pm

Hello,
I have the following problem: I'm reading a text field (user data input) which contains a command and a filename. For example, the user could insert something like:

Code: Select all

load c:\temp\my_file.txt
This is ok. I parse it using word 1 of textField (this is the command) and word 2 of textField (this is the filename).

The problem arise when the user wants to insert a filename with spaces. The user uses double-apex to manage filename. See here:

Code: Select all

load "c:\temp\this is the file.txt"
Now word 1 of textField gives me: load (correct)
but word 2 of textField gives me: "c:\temp\this is the file.txt" (included the double apex!)

And when I try to load the image, since it includes double apex it does not work.

So I decided to replace any apex and double-apex with "" (empty). My problem is I cannot (I don't know how to do it!) write a double apex to be replaced!
In pascal I use: "" (double double-apex) and in other languages I can put "\"" (see \" to indicate the double-apex).

How can I do it in Revolution?

Thank you for your help!

Mark Smith
Posts: 179
Joined: Sat Apr 08, 2006 11:08 pm
Contact:

Post by Mark Smith » Thu Mar 19, 2009 4:00 am

You can use the 'replace' command

replace quote with empty in tString

or

replace quote with "" in tString


Best,

Mark

ale870
Posts: 250
Joined: Tue Apr 22, 2008 9:17 am
Contact:

Post by ale870 » Thu Mar 19, 2009 8:32 am

Thank you!
I was looking for a way to represent quotes. Now I used numToChar(34) and numToChar(39) - single and double quotes - but quote keyword is really better!

Thank you!

Post Reply