Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

turning a sentence to an array java

String s = "This is a sample sentence.";
String[] words = s.split("s+");
for (int i = 0; i < words.length; i++) {
    // You may want to check for a non-word character before blindly
    // performing a replacement
    // It may also be necessary to adjust the character class
    words[i] = words[i].replaceAll("[^w]", "");
}
 
PREVIOUS NEXT
Tagged: #turning #sentence #array #java
ADD COMMENT
Topic
Name
3+1 =