0

I want to have the following line of code (shortened for clarity) :

Dim AllowedChar as string = "0..9 A..Za..z!$'()+,-.;=@[]^_`€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•..."

But whenever I save my file, Visual Studio (2010 and 2013) replaces “” with "".

How can I stop this behavior?

Kraz
  • 6,910
  • 6
  • 42
  • 70
  • try this : http://msdn.microsoft.com/en-us/library/613dxh46%28v=VS.71%29.aspx – Adjit May 22 '14 at 19:44
  • I find it ugly, but it works. Please post this as an answer so I can accept it. – Kraz May 22 '14 at 20:04
  • I don't think it would be that ugly. You have `Dim AllowedChar as string = "stuff...." + chrW(0093) + chrW(0094) + "moreStuff"` – Adjit May 22 '14 at 21:06
  • It's exactly what I find ugly :p – Kraz May 22 '14 at 21:43
  • Not sure if this would bring you back to the same issue... but you can set variables with `chrW(0093)` or even put it into an array. Might make it a bit neater if its a big concern – Adjit May 27 '14 at 14:00

1 Answers1

0

2 options:

  1. Escape the double curly quote by typing it twice. ie: ““ and ””. (Curly Quotes are escaped the same way straight ones are.

  2. Use the ascii code and concatenate the string: AllowedChar = AllowedChar + "“" + "”". (8220 and 8221 are the ascii codes for curly quotes).

Here's a similar answer from another question that should help: Using left double quotation marks in strings in VB

Community
  • 1
  • 1
Elisha Mooring
  • 161
  • 1
  • 1