Including quotes (") in data strings

Blitz3D Forums/Blitz3D Beginners Area/Including quotes (") in data strings

Fry Crayola(Posted 2004) [#1]
Is there any way to include '"' a data string, for example


Data "5'8"" to represent 5 foot 8 inches?

Obviously, the above example doesn't work. Nor does "5'8"+chr$(34) work in a data statement.

Any ways?


(tu) sinu(Posted 2004) [#2]
try

"5'8+chr$(34)"


Fry Crayola(Posted 2004) [#3]
I'll quote my first post here, where I said:

"Nor does "5'8"+chr$(34) work in a data statement."


Fry Crayola(Posted 2004) [#4]
Oh, sorry, misread. No, your method would surely result in a string being "5'8+chr$(34)", instead of "5'8""


Rob Farley(Posted 2004) [#5]
It doesn't work in data statements, so here's a question... why are you using data statements? If you let us know what you're trying to achieve maybe we can help.


Gabriel(Posted 2004) [#6]
Any reason you can't put your data in a textfile and read it in?


Graythe(Posted 2004) [#7]
When I try to read chr(34) at the datapointer blitz asks me to open a .bb file? Whats that all about?


JazzieB(Posted 2004) [#8]
You could always use a different character in your Data statments to represent your quotes and then use Replace() to change them.

Read a$
a$=Replace(a$,"^",Chr(34))

Print a$

WaitKey:End

Data "Jay said ^Well, hello there^."


A bit awkward, but it works.


doctorskully(Posted 2004) [#9]
Easy! In my experience of programming, I have found that if you just put in two single quotes (') instead of the double quotes (") there doesn't seem to be any noticable difference, if at all. Because you are not using the actual double quotes (at least as far as Blitz is concerned), it doesn't end your string.


jhocking(Posted 2004) [#10]
Clever! I'll have to remember that trick.


wizzlefish(Posted 2004) [#11]
Sometimes the simplest solutions can be the most productive.


Erroneouss(Posted 2004) [#12]
very clever JazzieB!
i would have never thought of that!


Fry Crayola(Posted 2004) [#13]
Deep Thought's idea is a good one. Fits the font I'm using lovely.

Rob - the Data statements contain information for various elements of a GUI. There's no reason why they can't be in data files either.