1

【译】使用保留大小写的查找和替换来保存您的命名方式

 11 months ago
source link: https://www.cnblogs.com/MeteorSeed/p/17749012.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【译】使用保留大小写的查找和替换来保存您的命名方式

  Visual Studio 搜索体验获得了一项新功能,允许用户查找和替换文本,而不必担心不同的大小写。例如,方法参数“catalogItemId”和对象属性“CatalogItemId”有相同的名称,但大小写不同,但都应该用类似“productId”的东西替换,并使用各自的大小写。

270073-20231008142938279-848785299.png

  该功能是由用户请求的,他们正在各种论坛上寻找一种简单的方法来查找和替换文本,而不必担心各种命名方式的不同大小写,包括 Stack Overflow 和 Developer Community Case-Preserving Search & Replace Across Multiple Files。我们很高兴地宣布,保留大小写的查找和替换在 Visual Studio 17.8 预览1 中可用!

270073-20231008142959880-757289042.gif

  我们致力于维护和改进 Visual Studio 中的搜索体验。多年来,我们一直在不断增强和更新搜索。你可以透过以下链接了解更多有关这些改变:

  - Search – Visual Studio Blog (microsoft.com):https://devblogs.microsoft.com/visualstudio/tag/search/

  - Find – Visual Studio Blog (microsoft.com):https://devblogs.microsoft.com/visualstudio/tag/find/

  - Find in Files – Visual Studio Blog (microsoft.com):https://devblogs.microsoft.com/visualstudio/tag/find-in-files/

如何使用

  当您执行替换时,您现在可以保留代码中每个匹配的原始大小写。在“替换”窗口中用“Alt+V”或点击“保留大小写”选项切换保存大小写。

  快速替换(Ctrl+H):

270073-20231008143030258-1225518103.png

  替换文件(Ctrl+Shift+H):

270073-20231008143049087-1784621274.png

  要获得 Pascal case 和 Camel case,你的替换字符串也必须是 Pascal case 或 Camel case。大小写也保留在包含连字符或下划线的文本中。

  -将“begin”替换为“end”会使“Begin”变为“End”,而“BEGIN”变为“END”。

  -将“onetwothree”改为“fourFiveSix”,将“onetwothree”改为“fourfivesix”,“oneTwoThree”改为“fourFiveSix”,“OneTwoThree”改为“FourFiveSix”。

尝试一下,让我们知道你的想法

  在等待稳定版本发布时,可以在 17.8 预览版 1 及更高版本中试用保留大小写替换体验。请随时为开发者社区的现有票证做出贡献,并开发者社区上报告您发现的任何问题。

  原文链接:https://devblogs.microsoft.com/visualstudio/keep-your-casing-with-case-preserving-find-and-replace/

270073-20231008143130317-652146160.png

作者:MeteorSeed

我希望您喜欢这篇博文,并一如既往地感谢您阅读并与朋友和同事分享我的博文。

转载请注明出处。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK