Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

all possible substrings of a string java of specific length

String s = "example string";
for (int i = 0; i <= s.length() - 3; i++) {
    String substr = s.substring(i, i + 3);
    if (substr.matches("[a-zA-Z]+")) { System.out.println(substr); }
}
 
PREVIOUS NEXT
Tagged: #substrings #string #java #specific #length
ADD COMMENT
Topic
Name
6+6 =