i want refactor variables names.
variable_foo
to
variableFoo
Is it possible to do this using find/replace tool of eclipse??
edit:
My problem isn't only replace '_', but edit the next letter to upper case.
Its possible using regex??
There is a plugin available in Eclipse Marketplace called AnyEditTools which addsa bunch of conversion options, one of them is from/to camelCase
and underscore_names
(Alt+Ctrl+K
).
However, Eclipse' Java editor currently (Indigo) lacks proper navigation in identifiers_with_underscores
- it only works for CONSTANT_NAMES_CURRENTLY
. (Details here: https://bugs.eclipse.org/bugs/show_bug.cgi?id=67381)
These links
http://www.php.net/manual/en/function.preg-replace.php#89364
http://www.blog.highub.com/regular-expression/perl-regex/perl-regex-capitalize-the-first-letter-of-a-word/
seem to indicate that Perl and/or PHP Regex syntax supports a \u operator that upper-cases the match following it in the replacement expression - and I think I interpret it to be a holdover from 'vi' (UNIX text editor) - no clue as to why it doesn't seem to exist in a more modern and popular regex implementation
So, if you can get your code onto a system that supports an appropriate version of vi (or an editor that fully supports this perl syntax), and then figure out how to open your documents in it, how to run a find-replace, etc.. then you'd have to use an expression like the following:
/\b(\w+?)_(\w+)/$1\u$2/
or
find: \b(\w+?)_(\w+)
replace: $1\u$2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With