2

I'm using the BASIC language. Is there any way to include double quotes in a string?

I tried using \" but it doesn't work.

NOTE: I'm using Nano-10 PLC which supports combination of Ladder and BASIC

Dushyant Bangal
  • 6,048
  • 8
  • 48
  • 80

3 Answers3

2

@vlad awtsu's answer is correct for the normal BASIC language. (+1 for him)

However it didn't work for me on the PLC I've mentioned in the question.

Using CHR$(&H22) did the job for me. (also works on normal BASIC)

Print "Hello "+ CHR$(&H22) +"World"+CHR$(&H22)

It prints:

Hello "World"

Dushyant Bangal
  • 6,048
  • 8
  • 48
  • 80
1

try this one

"She said, ""You deserve a treat!"" " 

add "" ""

Dushyant Bangal
  • 6,048
  • 8
  • 48
  • 80
vlad awtsu
  • 185
  • 1
  • 2
  • 14
0

Dushyant Bangal is correct - although CHR$(34) should work equally well. There is no need to put the value into hex unless you have a preference for it.

(Also, whether doubling up the "" works in "normal BASIC" depends what you mean by "normal". I've seen countless dialects in which CHR$ is the only option.)

rjpond
  • 101
  • 2
  • I tried `""`on https://www.tutorialspoint.com/compile_freebasic_online.php and it worked, so figured it only doesn't work on this PLC. Good to know thats not the only one. – Dushyant Bangal Aug 18 '17 at 12:54