Java – How do I recognize line breaks in editText text?

How do I recognize line breaks in editText text?… here is a solution to the problem.

How do I recognize line breaks in editText text?

I’m getting text from a multi-line edit text. I need to identify line breaks in this article. How?

s.toString().contains("\\n")

An error is returned.

Solution

There are typos. It should be:

s.toString().contains("\n")

Related Problems and Solutions