Page 1 of 1
quotes
Posted: Tue Jul 18, 2017 3:50 pm
by Rjevsky
Maybe this has already been discussed, but I would like to be able to use several kinds of quotes in the code, like AutoIt or PHP.
Code: Select all
Debug(' "Hello Word" ')
Debug(' " '+'Hello Word'+' " ')
Personally, I do not really have this possibility when working with text files and JSON.
I know that you can use Chr (34), but the code becomes very poorly readable.
Re: quotes
Posted: Tue Jul 18, 2017 4:39 pm
by kenmo
Hi, I think this has been requested before somewhere.
One problem is that single-quotes already have a syntax meaning in PB, they are used for character values:
Code: Select all
Str.s = "A"
Char.c = 'A'
Debug Char
Some nicer ways you can use double-quotes now:
Code: Select all
; Escaped strings (PB 5.40+)
Debug ~"\"Hello World\""
; Constant instead of Chr(34)
Debug #DQUOTE$ + "Hello World" + #DQUOTE$
; Shorter constant :)
#DQ$ = #DQUOTE$
Debug #DQ$ + "Hello World" + #DQ$
; Macros
Macro DQ(Text)
#DQUOTE$ + Text + #DQUOTE$
EndMacro
Macro SDQ(Text)
ReplaceString(Text, "'", #DQUOTE$)
EndMacro
Debug DQ("Hello World")
Debug SDQ("'Hello World'")
Re: quotes
Posted: Wed Jul 19, 2017 8:51 am
by User_Russian
Re: quotes
Posted: Wed Jul 19, 2017 10:10 am
by Bisonte
uuhh. Since 5.40 ? oh I think I have to read the changelog more carefully....
And I make my "html" strings with the "old" techniques
