java detect new line in string

Solutions on MaxInterview for java detect new line in string by the best coders in the world

showing results for - "java detect new line in string"
Michela
22 Aug 2020
1String word = "A string \n with a new Line inside"
2String newline = System.getProperty("line.separator");
3boolean hasNewline = word.contains(newline);
4if(hasNewLine){
5	System.out.println("Enter has been pressed");
6}