francoisg Active Member Licensed User Longtime User Jul 1, 2011 #1 Hi, when I do something like the following: Dim s As String s = "this is a ""quoted"" string" Code highlighting works 100% in the IDE editor but when I try to compile I get ... ------------------------------------------------------------------------ Compiling code. Error Error parsing program. Error description: Syntax error. Occurred on line: 70 s = "this is a ""quoted"" string" ------------------------------------------------------------------------ Obviously I can go "s = "This is a " & QUOTE & "quoted" & QUOTE " string" but that's just stupid!
Hi, when I do something like the following: Dim s As String s = "this is a ""quoted"" string" Code highlighting works 100% in the IDE editor but when I try to compile I get ... ------------------------------------------------------------------------ Compiling code. Error Error parsing program. Error description: Syntax error. Occurred on line: 70 s = "this is a ""quoted"" string" ------------------------------------------------------------------------ Obviously I can go "s = "This is a " & QUOTE & "quoted" & QUOTE " string" but that's just stupid!
S SteveBee Member Licensed User Longtime User Jul 1, 2011 #2 I confirm this behavior - B4a doesn't like the "" construct. I encountered it when doing a string replace: ... .Replace("""", ... Caused a GPF ... .Replace(chr(34), ... Was ok.
I confirm this behavior - B4a doesn't like the "" construct. I encountered it when doing a string replace: ... .Replace("""", ... Caused a GPF ... .Replace(chr(34), ... Was ok.
K kickaha Well-Known Member Licensed User Longtime User Jul 1, 2011 #3 Be interested to hear why that is "just stupid" ( or should that be QUOTE&"just stupid"&Quote), as it is pretty similar to other languages.
Be interested to hear why that is "just stupid" ( or should that be QUOTE&"just stupid"&Quote), as it is pretty similar to other languages.
S splatt Active Member Licensed User Longtime User Jul 2, 2011 #4 francoisg said: Hi, Obviously I can go "s = "This is a " & QUOTE & "quoted" & QUOTE " string" but that's just stupid! Click to expand... This is just standard string concatenation. It's what you would expect to do!
francoisg said: Hi, Obviously I can go "s = "This is a " & QUOTE & "quoted" & QUOTE " string" but that's just stupid! Click to expand... This is just standard string concatenation. It's what you would expect to do!
S SteveBee Member Licensed User Longtime User Jul 2, 2011 #5 Of course none of this actually addresses the original issue - that using "" causes a code failure.
eps Expert Licensed User Longtime User Jul 2, 2011 #6 No programming language will handle quotes in strings, it just doesn't work, how would you expect a compiler or interpreter to understand that it's a quote which is part of a string as opposed to a quote which ends a string..
No programming language will handle quotes in strings, it just doesn't work, how would you expect a compiler or interpreter to understand that it's a quote which is part of a string as opposed to a quote which ends a string..
nfordbscndrd Well-Known Member Licensed User Longtime User Jul 2, 2011 #7 eps said: No programming language will handle quotes in strings, it just doesn't work, how would you expect a compiler or interpreter to understand that it's a quote which is part of a string as opposed to a quote which ends a string.. Click to expand... I went to the Immediate window of VB6 and typed the first line and it responded with the second line: Code: Print "This is a ""quote"" from VB6." This is a "quote" from VB6. It can understand that it's a quote because 2 in a row = a quote in the text while a single quote ends a string.
eps said: No programming language will handle quotes in strings, it just doesn't work, how would you expect a compiler or interpreter to understand that it's a quote which is part of a string as opposed to a quote which ends a string.. Click to expand... I went to the Immediate window of VB6 and typed the first line and it responded with the second line: Code: Print "This is a ""quote"" from VB6." This is a "quote" from VB6. It can understand that it's a quote because 2 in a row = a quote in the text while a single quote ends a string.
barx Well-Known Member Licensed User Longtime User Jul 2, 2011 #8 ASP (vbscript) is the same "" = quote. Though I won't be looking sleep over it lol Sent from my Desire Z
ASP (vbscript) is the same "" = quote. Though I won't be looking sleep over it lol Sent from my Desire Z
francoisg Active Member Licensed User Longtime User Jul 4, 2011 #9 "Stupid" because it make reading the code harder - changing it afterwards and keeping things in the correct place is an issue as well. I just like my code to be as neat and tidy as possible! And the comment "No programming language will handle quotes in strings..." - that's just funny ;-) Can we confirm that the translator / compiler handles this incorrectly? Especially as the code highlighting works as expected in the IDE??? So can we either change code highlighting to NOT display it as I expect to do or fix the translator (should be easy enough to do???) ??? Still, this is one of the easiest ways to code for Android. Please do not see this post as criticism!!! I think all of us wants the best possible product - for the publisher that means more sales ;-) Regards, Marius le Roux (South Africa)
"Stupid" because it make reading the code harder - changing it afterwards and keeping things in the correct place is an issue as well. I just like my code to be as neat and tidy as possible! And the comment "No programming language will handle quotes in strings..." - that's just funny ;-) Can we confirm that the translator / compiler handles this incorrectly? Especially as the code highlighting works as expected in the IDE??? So can we either change code highlighting to NOT display it as I expect to do or fix the translator (should be easy enough to do???) ??? Still, this is one of the easiest ways to code for Android. Please do not see this post as criticism!!! I think all of us wants the best possible product - for the publisher that means more sales ;-) Regards, Marius le Roux (South Africa)
Erel B4X founder Staff member Licensed User Longtime User Jul 4, 2011 #10 I think that this is a good feature request and I hope that it will be added. From my experience such "core" features are never too simple to be implemented.
I think that this is a good feature request and I hope that it will be added. From my experience such "core" features are never too simple to be implemented.