搜索字符串文字 [英] Searching For String Literals

查看:35
本文介绍了搜索字符串文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在寻求本地化的过程中,我需要找到散落在我们源代码中的所有字符串文字.我正在寻找一种将其编写到修改后源存储库检查中的方法.(在某些人检查某些内容后,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:

  1. 在文件中查找 (CTRL+SHIFT+F)
  2. 使用:正则表达式
  3. 查找::q(带引号的字符串)
  4. 查找全部

查找结果"窗口现在将包含所有文件的报告,包括行号和带引号的字符串的行本身.

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)

这篇关于搜索字符串文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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