I am making a program that searches for a character string in Java, and when the search character string is found, displays the character string from the beginning of the line to just before the search character string.
I want to get the execution result like this. ↓
Current execution result
Current source code
Supplementary information PC： MAC Editor: Atom