What are kinds of whitespaces in Java? I need to check in my code if the text contains any whitespaces.
My code is:
if (text.contains(" ") || text.contains("\t") || text.contains("\r")
|| text.contains("\n"))
{
//code goes here
}
I already know about \n
,\t
,\r
and space
.