Replacing each instance of a string literal with a constant
Answered
I looked and could only find one very old post about this and the answer is no longer valid. I'd like to replace ALL instances of a particular string literal in a file. Sonar finds one, I replace it and then have to do a "replace all" to catch the other ones. I swear this has worked before but just on occasion. Not saying there's a bug, just don't know what I did to make it work. Just using ctrl-alt-C to do this.
Please sign in to leave a comment.
Extract Constant refactoring has an option to replace all occurrences, please refer to https://www.jetbrains.com/help/idea/extract-constant.html.
If it doesn't work for you, please share a small sample project with the exact steps to reproduce the issue: https://uploads.jetbrains.com.
Thank you! You're the dopest!