toby Well-Known Member Licensed User Longtime User Apr 25, 2025 #1 Code: Copy Private strMsg as string=""Hello world" 'I meant to type "Hello world" log(strMsg) 'Empty string is printed As shown, there is an extra double quote, by mistake, at the beginning of the text. And both IDE and compiler ignore Hello World" part once they reach the second double quote thinking it's an empty string. Last edited: Apr 25, 2025
Code: Copy Private strMsg as string=""Hello world" 'I meant to type "Hello world" log(strMsg) 'Empty string is printed As shown, there is an extra double quote, by mistake, at the beginning of the text. And both IDE and compiler ignore Hello World" part once they reach the second double quote thinking it's an empty string.
drgottjr Expert Licensed User Longtime User Apr 25, 2025 #2 not ignored; doesn't compile here... Attachments capture.jpg 35.7 KB · Views: 312 Last edited: Apr 26, 2025
toby Well-Known Member Licensed User Longtime User Apr 26, 2025 #3 drgottjr said: not ignored; doesn't compile here... Click to expand... It's strange. My screenshot shows that my B4A IDE behaves differently from yours. I'm using B4A 13.10 on 64-bit Windows 11, by the way.
drgottjr said: not ignored; doesn't compile here... Click to expand... It's strange. My screenshot shows that my B4A IDE behaves differently from yours. I'm using B4A 13.10 on 64-bit Windows 11, by the way.
toby Well-Known Member Licensed User Longtime User Apr 26, 2025 #4 test project attached Attachments extraQuote.zip extraQuote.zip 264 KB · Views: 220
toby Well-Known Member Licensed User Longtime User Apr 26, 2025 #5 I've finally figured out how to reproduce Step 1. Declare a valid string. Code: Copy Private strMsg as string="Hello world" Step 2. Insert a double quote anywhere in the above string: Code: Copy Private strMsg as string="Hell"o world" IDE will happily accept it without further validation while compiler would truncate the string at the insertion point. The above declaration will cause strMsg to contain "Hell" instead of expected "Hello World". Last edited: Apr 27, 2025
I've finally figured out how to reproduce Step 1. Declare a valid string. Code: Copy Private strMsg as string="Hello world" Step 2. Insert a double quote anywhere in the above string: Code: Copy Private strMsg as string="Hell"o world" IDE will happily accept it without further validation while compiler would truncate the string at the insertion point. The above declaration will cause strMsg to contain "Hell" instead of expected "Hello World".