- 1
Java code to find new line character in a string without using loop?
new line character
2 Answers
+ 2
Have you tried using string.contains("\n");
String s = "hello\nhow are you?";
if(s.contains("\n")) {
System.out.println("Yes");
}
+ 1
https://commons.apache.org/proper/commons-lang/javadocs/api-2.6/org/apache/commons/lang/StringUtils.html#indexOfAny(java.lang.String, java.lang.String[])