开发者

How to replace a string in eclipse?

I have 500+ program files in a 开发者_运维知识库project. I would like to replace a string "vector" to "std::vector" in all the files. How can I do this in Eclipse? I am using Eclipse CDT Helios.

(One option is to use Search->Search and enter the string to be replaced and press "Replace" button. But the problem here is that, it will replace "vectorOfPoints" and "pointsVector" also.)


I guess you could just search for ' vector ' and replace it with ' std::vector ' as you described yourself. Instead make sure there is a space leading and ending your search, so you take only the single word vector.

Maybe you'll only need a space in the end, if vector occurs at the start of a new line. Also make sure your search is case sensitive.


By using Search -> File... from the menu you can search for strings in any files. As Containing text you should use a regular expression so that vectorOfPoints will not match. Then click on Replace... and Eclipse will look up all occurrences. Here you can even have a preview before executing the replace operation.


You can use Edit->Find/Replace and from options select whole world so it will not replace vectorOfPoints

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜