Including quotes (") in data strings
Blitz3D Forums/Blitz3D Beginners Area/Including quotes (") in data strings
| ||
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? |
| ||
try "5'8+chr$(34)" |
| ||
I'll quote my first post here, where I said: "Nor does "5'8"+chr$(34) work in a data statement." |
| ||
Oh, sorry, misread. No, your method would surely result in a string being "5'8+chr$(34)", instead of "5'8"" |
| ||
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. |
| ||
Any reason you can't put your data in a textfile and read it in? |
| ||
When I try to read chr(34) at the datapointer blitz asks me to open a .bb file? Whats that all about? |
| ||
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. |
| ||
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. |
| ||
Clever! I'll have to remember that trick. |
| ||
Sometimes the simplest solutions can be the most productive. |
| ||
very clever JazzieB! i would have never thought of that! |
| ||
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. |