خرید بک لینک

Vote count: 0

I have the following string as an inpute: "ABCDE", i want to divide it into substrings of two chars: "AB" ,"BC", "CD", "DE",

I tried with the following code:

String route = "ABCDE";
int i = 0;

 while(i < route.length()) {
            String sub = route.substring(i,i+2);
            System.out.println(sub);
            i++;
        }

but the index i gets out of range. is there anyway to do this ?

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: دوشنبه 28 تير 1395 ساعت: 9:04

صفحه بندی