Searching For String Literals(搜索字符串文字)
问题描述
在寻求本地化的过程中,我需要找到散落在我们源代码中的所有字符串文字.我正在寻找一种将其编写到修改后源存储库检查中的方法.(在某些人检查某些内容后,IE 有一个框设置来检查此统计信息)我可能会使用 NAnt 和 CruiseControl 或其他东西来处理 CVS 的管理(在我的情况下是 StarTeam :()但是你知道任何可编写脚本的吗(或命令行)实用程序来准确循环通过源代码查找字符串文字?我意识到我可以根据正则表达式进行简单的字符串查找,但想要更多的收益.(也许分析字符串或将其分类) 因为很多时候字符串不一定需要翻译.有什么想法吗?
In the quest for localization I need to find all the string literals littered amongst our source code. I was looking for a way to script this into a post-modification source repository check. (I.E. after some one checks something in have a box setup to check this stat) I'll probably use NAnt and CruiseControl or something to handle the management of the CVS (Well StarTeam in my case :( ) But do you know of any scriptable (or command line) utility to accurately cycle through source code looking for string literals? I realize I could do simple string look up based on regular expressions but want a little more bang for my buck. (Maybe analyze the string or put it into categories) Because a lot of times the string may not necessarily require translation. Any ideas?
推荐答案
Visual Studio 2010 及更早版本:
Visual Studio 2010 and earlier:
- 在文件中查找 (CTRL+SHIFT+F)
- 使用:正则表达式
- 查找:
:q
(带引号的字符串) - 查找全部
查找结果"窗口现在将包含所有文件的报告,包括行号和带引号的字符串的行本身.
Find Results window will now contain a report of all files, with line numbers and the line itself with the quoted string.
对于 Visual Studio 2012 及更高版本,搜索 ((".+?")|('.+?'))
(参考,对 @CincauHangus)
For Visual Studio 2012 and later search for ((".+?")|('.+?'))
(reference, hat-tip to @CincauHangus)
这篇关于搜索字符串文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:搜索字符串文字


基础教程推荐
- 如果条件可以为空 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 将数据集转换为列表 2022-01-01
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01