Skip to main content



      Home
Home » Newcomers » Newcomers » Replacing same variable multiple time in a for statement(Editing Eclipse JDT)
Replacing same variable multiple time in a for statement [message #656817] Mon, 28 February 2011 12:37 Go to next message
Eclipse UserFriend
Hello:

I want to change or replace the same variable all at once in the same line or
same scope within a pair of braces, how do I do it all at once?

I could use Find /Replace, but there is problems associate with replace.
Here is an example:
for (int i = 0; i < actual.length; i++) 


If I do a Find /Replace of "i" with Z, for example, then I would get this:
for ( Znt Z = 0; Z < actual.length; Z++) 
// other codes here that needs replacement of "i"



the error is Znt, which should be int.
So, there should be a way for me to select multiple lines
and then invoke auto replace of I with "Z" without
changing other variables that has "i" in the name or etc...

Something similar auto replace after invoking Ctrl Space to insert a template.

Re: Replacing same variable multiple time in a for statement [message #656821 is a reply to message #656817] Mon, 28 February 2011 12:45 Go to previous messageGo to next message
Eclipse UserFriend
Select the variable you with to change, right click, and select Refactor->Rename. This will highlight all instances of the variable. Changing the variable name is automatically propagated to all of the instances.
Re: Replacing same variable multiple time in a for statement [message #656822 is a reply to message #656821] Mon, 28 February 2011 12:49 Go to previous message
Eclipse UserFriend
Thanks.
Previous Topic:Error when debugging with Eclipse Helios
Next Topic:Code Assist not displaying some mysqli functions
Goto Forum:
  


Current Time: Wed Aug 20 05:02:47 EDT 2025

Powered by FUDForum. Page generated in 0.07216 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top