Find/Replace and Preserve Case

I'm struggling to understand what this (subject) feature is for.

What I expected was that when doing a find/replace with "Preserve Case" checked that it would do a "smart case" replacement. For example on replacing String with Integer:

would be changed to:

But instead, it's changed to:

Admittedly, this is a contrived example, but it does illustrate the point.

So, is this supposed to be a "smart case" search and replace? If not what do people use it for, and is it possible to do a "smart case" search by some other means?

2 comments


Mark Lee wrote:

... For example on replacing String with Integer:
...
But instead, it's changed to:

 public void setInteger( Integer Integer );
> ]]>


I noticed that the replacement text must be all lower-case letters for this
option to work properly. I think it's a bug. Case of the the replacement text
shouldn't matter. Feel free to file an SCR.


Sascha


0

It is a bug, thank you.
Now if you have String -> Integer the following replacements will be done:
String -> Integer
string ->integer
STRING -> INTEGER
sTRING -> iNTEGER
In other words, case of the first letter is preserved and if the case of the
whole tail is the same, then it is also preserved.

Eugene.

"Mark Lee" <no_mail@jetbrains.com> wrote in message
news:20532781.1069149555146.JavaMail.itn@is.intellij.net...

I'm struggling to understand what this (subject) feature is for.

>

What I expected was that when doing a find/replace with "Preserve Case"

checked that it would do a "smart case" replacement. For example on
replacing String with Integer:

 public void setString( String string );
> ]]>

would be changed to:

 public void setInteger( Integer integer );
> ]]>

But instead, it's changed to:

 public void setInteger( Integer Integer );
> ]]>

Admittedly, this is a contrived example, but it does illustrate the point.

>

So, is this supposed to be a "smart case" search and replace? If not what

do people use it for, and is it possible to do a "smart case" search by some
other means?
>


0

Please sign in to leave a comment.