Is there a simple way to search for a string in the source code, when I only want to find the string as a whole word.
ie if I have a variable named "variable" and another named "variable1", I want to search / replace "variable" while leaving "variable1" unchanged.
the only way I can see is to use regular expressions and search for "/svariable/s".
I often want to find all occurences of "variable", replace them with "new_variable" without changing "variable1".
Is there an easy way to do this.
If you are familiar with CodeWright, it is searching with the "whole word" box selected.
searching
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: searching
With the project saved (and ideally built successfully), try selecting the variable, right-clicking and hitting Refactor/Rename or ALT+Shift+R. When you do, a small box appears around the variable. When you hit enter, the changes apply to all instances. If the project was not previously built successfully, this process is can have issues because the map is not yet really intact.
Re: searching
Thanks for that tip, it does exactly what I want.
I have not used any of the refactoring functions before, but they look very useful.
I need to explore the Eclipse environment more, I'm sure there are other things in there that would save me time.
If you are aware of any good intro to eclipse docos I could read, please point me there.
Roland
I have not used any of the refactoring functions before, but they look very useful.
I need to explore the Eclipse environment more, I'm sure there are other things in there that would save me time.
If you are aware of any good intro to eclipse docos I could read, please point me there.
Roland
-
- Posts: 513
- Joined: Sat Apr 26, 2008 7:14 am
Re: searching
Tod's Eclipse tips are superb:
http://syncor.blogspot.com/2010/03/eclipse-tips.html
http://syncor.blogspot.com/2011/02/ten- ... art-3.html
http://syncor.blogspot.com/2010/03/eclipse-tips.html
http://syncor.blogspot.com/2011/02/ten- ... art-3.html