在Visual Studio中保留大小写查找/替换 [英] Case preserving find/replace in Visual Studio

查看:199
本文介绍了在Visual Studio中保留大小写查找/替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

似乎没有内置支持在Visual Studio中保留大小写查找/替换(另请参见相应的

There seems to be no built-in support for case preserving find/replace in VisualStudio (see also a respective feature request).

我的意思是:搜索"BadJob"并替换为"GoodJob"将进行以下替换

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).

更新:
我知道我可以做4个手动替换来完成这项工作,但是我正在寻找一种在VS中自动完成的方法(例如Emacs可以做到). 一个常见的场景:一个名为"foo"的变量和一些函数DoFoo(),GetFoo(),...以及一些其他包含"foo","Foo"的注释等. 现在将"foo"重命名为"bar",从而产生一个变量"bar",并通过一次查找/替换功能来实现DoBar(),GetBar()等功能.

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.

推荐答案

目前在Visual Studio中不可能.

It's not possible in Visual Studio at the moment.

您可以为此功能投票:

https://developercommunity.visualstudio.com/content/idea/580810/case-preserving-search-replace.html

我通常最终会打开Sublime Text,然后复制并复制.将代码粘贴到此处,在此处执行保留大小写的替换,然后复制并复制;粘贴回Visual Studio.

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.

这篇关于在Visual Studio中保留大小写查找/替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆