There seems to be no built-in support for case preserving find/replace in VisualStudio (see also a respective feature request).
What I mean is: searching for 'BadJob' and replacing with 'GoodJob' would do the following replacements
'badjob' -> 'goodjob' 'BadJob' -> 'GoodJob' 'badJob' -> 'goodJob' 'BADJOB' -> 'GOODJOB'
So I am looking for a macro/add-in which implements case preserving find/replace. And if none exists, what is a good starting point to write my own (preferably based on the built-in find/replace capabilities).
Update:
I know I can make 4 manual replacements doing the job, but I am looking for a way to do it automatically in VS (like e.g. Emacs does it). A common scenario: a variable named 'foo' and some functions DoFoo(), GetFoo(), ... and some additional comments containing 'foo' 'Foo' etc. Now rename 'foo' to bar' yielding variable 'bar', functions DoBar(), GetBar() etc. by ONE find/replace.
Replace (default shortcut is Ctrl+H ). Use this item to find and replace text in the Code Editor. The search options are similar to those of the Find Text dialog. See Replace dialog for details.
It's not possible in Visual Studio at the moment.
You can vote for this feature:
https://developercommunity.visualstudio.com/content/idea/580810/case-preserving-search-replace.html
I usually end up opening Sublime Text, Copy & Paste the code there, perform the case-preserving replacements there and Copy & Paste back to Visual Studio.
open up the find options when you do the find/replace. check the case-sensitive option. you will have to do the flavours manually unless you do something like: http://www.aaronlerch.com/blog/2007/03/28/visual-studio-find-and-replace-regular-expressions/, or use something like: http://www.download3k.com/MP3-Audio-Video/Utilities-Plug-Ins/Download-Find-Replace.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With