"I want to tell you about a few more magic tricks."
"Please do! Today is simply a day of miracles. It seems I haven't been using half of IntelliJ IDEA's features."
Magic trick #4: Search.
"Imagine that you've opened a file with 5,000 lines, and you need to find a method called getProcessTask. Or getProcessorTask or getTaskProcessor or something like that."
"IntelliJ IDEA has a very powerful mechanism for searching the current open file."
"Just press Ctrl+F and start typing the word you need:"
"For example, if we want to find every call to the println method, then we'd type println:"
"And you can navigate through the matches using the up and down arrows. I've circled them the screenshot."
"There are more checkboxes on the right: Match Case, Regex, and Words. What do they mean?"
"MatchCase makes the search case sensitive. If cleared, there is no distinction made between uppercase and lowercase letters. If selected, then uppercase and lowercase letters are considered different. For example, «Print» wouldn't match «print»."
"Selecting the Regex checkbox tells IntelliJ that the search string is actually a regular expression."
"Selecting the Words checkbox indicates that a word must completely match what we have. Partial matches don't count."
"For example, if I have print and println, methods and I only want to find print, then I'll need to check this box. In the example below, I specifically replaced two occurrences of println with print, and found only those two by selecting the Words checkbox."
"In other words, Words switches between «part of the word matches the search string» and «the whole word matches the search string»?"
Magic trick #5: Replace.
"Imagine you have some code and you want to replace a few method calls with other method calls. "You simply want to replace a code fragment with another code fragment. That's it. How can you do that quickly?"
"The Ctrl+R key combination does this."
"Let's replace println with print.
"To make sure the replacement operation doesn't happen in the entire class, you need to select the desired part of the code and select the «In Selection» checkbox."
"Now you can boldly press the «Replace all» button and all println entries in the selected code will be replaced with print."
"That's true. Everything works great. Thank you, Ellie!"
GO TO FULL VERSION