java detect new line in string

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

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
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}