I want an output as follow [ABCDE],
[AB,BC,CD,DE],[ABC,BCD,CDE],[ABCD,BCDE],[ABCDE]
Please look at my code and give me solution asap.
public void algoOne()
{
String str= "A B C D E";
String delims = " ";
StringTokenizer st = new StringTokenizer(str, delims);
while(st.hasMoreTokens())
{
String temp = st.nextToken();
tokensArray.add(temp);
finalStr += " "+ temp;
count = tokensArray.size();
}
System.out.println("Different values of Tokens : " + tokensArray +" <>
"+ count);
}
I want to read the tokens in following way:
[ABCDE], [AB,BC,CD,DE],[ABC,BCD,CDE],[ABCD,BCDE],[ABCDE]
No comments:
Post a Comment