Java examples for java.lang:String Substring
get All Possible Substring Combinations
//package com.java2s; import java.util.LinkedList; public class Main { public static LinkedList<String> getAllPossibleSubstringCombinations( String str, int maxWords) { LinkedList<String> ret = new LinkedList<String>(); String partsStr[] = str.split(" "); for (int j = 0; j < (partsStr.length - maxWords); j++) { String currentStr = ""; for (int i = 0; i < maxWords; i++) { currentStr += partsStr[j + i] + " "; ret.add(currentStr);/*w w w .ja v a2s. c om*/ } } return ret; } }