Page 1 of 1

searching

Posted: Wed Nov 07, 2012 7:01 pm
by roland.ames
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.

Re: searching

Posted: Thu Nov 08, 2012 4:55 am
by Ridgeglider
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

Posted: Thu Nov 08, 2012 7:35 pm
by roland.ames
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

Re: searching

Posted: Thu Nov 08, 2012 8:34 pm
by Ridgeglider