Exchanging Quotes
Sometimes you need to exchange a choice of quotes in some code.
Start file
mystring = 'This quoted string contains \' and is also' 'surrounded with \' characters. It is also' 'a multiline string too'
End file
mystring = "This quoted string contains ' and used to be" "surrounded with ' characters. It is also" "a multiline string too"
View Diff
1,3c1,3 < mystring = 'This quoted string contains \' and is also' < 'surrounded with \' characters. It is also' < 'a multiline string too' --- > mystring = "This quoted string contains ' and used to be" > "surrounded with ' characters. It is also" > "a multiline string too"
Solutions
The best way to learn is to practice. Below, you will find some of the solutions other golfers have entered. To unlock higher ranked solutions, submit your own entry which does as well or better than the solutions you can currently see - climb the ladder!
Check out these helpful resources to improve your Vim skills... Game on.
Unlock 227 remaining solutions by signing in and submitting your own entry
#228 Viktor Jackson / @AntiStalinista - Score: 87 - 05/05/12 @ 03:08
:%s# '# "#g<CR>:<Up><Left><Left><Left><Left><Left><Left><Left><Right><Right><Left><BS><Right>$<Right><Right><Right><CR>u:<Up><Left><Left><Left><BS><CR>:%s$<BS>#\\##g<CR>1G$3bt"3bct"and used to be<Esc>:w<CR>;q<CR>:q<CR>
0 comments