String s = "6158"; i have to split this as substrings like 6, 1, 5, 8, 61, 15, 58, 615, 158, and 6158. Here is my code
code:
--------------------------------------------------------------------------------
String s = "6158";
for(int i=0;i<s.length();i++)
{
System.out.println(s.charAt(i));
}
int i=0;
int l=1;
while(i<s.length()){
while(l<=s.length()){
System.out.println(s.substring(i,l));
l++;
}
i++;
}
--------------------------------------------------------------------------------
Output: 2 3 1 9 2 23 231 2319 But i am not able to get the all the values, i have tried lot of ways. please any one help me how to get it.