views:

65

answers:

2

How can I paste curly quotes into my IDE as straight quotes? I will often paste code into Visual Studio from PDF files. Then I have to change all the quotation marks to "straight" ones. Ive tried the programs that strip formatting but they don't work. Below is a pic of what I mean.

alt text

Thanks

+1  A: 

Not perfect, but when I have that issue (assuming you're pasting large chunks of text?) I paste into notepade (or notepad++) and do a find - replace.

Dave
Surely the IDE has these features, too...
Michael Haren
That's pretty much what I do now. I was hoping for a more "Lazy Man's" way of doing it.
JimDel
yea of course it does, but notepad++ has so many plugins and so many features that I find it's easier to use it as a middle man for most test I need transformed :) Sorry its not any nicer than your current method!
Dave
+1  A: 

You could write an Add-In to do this, but for quick and easy I did it with this Macro and added a button to my Toolbar to run it:

Imports EnvDTE

Public Module Module1

    Sub RemoveSmartQuotes()

        Dim sFind() As String = New String() {Chr(145), Chr(146), Chr(147), Chr(148)}
        Dim sReplace() As String = New String() {Chr(39), Chr(39), Chr(34), Chr(34)}

        For i As Integer = 0 To sFind.Length - 1
            DTE.Find.Action = vsFindAction.vsFindActionReplaceAll
            DTE.Find.FindWhat = sFind(i)
            DTE.Find.ReplaceWith = sReplace(i)
            DTE.Find.Target = vsFindTarget.vsFindTargetCurrentDocument
            DTE.Find.MatchCase = False
            DTE.Find.MatchWholeWord = False
            DTE.Find.MatchInHiddenText = True
            DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
            DTE.Find.KeepModifiedDocumentsOpen = False
            DTE.Find.FilesOfType = ""
            DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResultsNone
            DTE.Find.Execute()
        Next i

    End Sub
End Module
Bob
Awesome, that works perfectly. Thank you!
JimDel