Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java check if string contains multiple words

String str1 = "It's a great day today.";
        
String[] words = str1.split(" "); 
//["It's", "a", "great", "day", "today."]

boolean hasMultipleWords = words.length > 1;

System.out.println(hasMultipleWords);
 
PREVIOUS NEXT
Tagged: #java #check #string #multiple #words
ADD COMMENT
Topic
Name
9+2 =