Any ideas why my loop doesn´t verify???
package com.codegym.task.task22.task2203;
/*
Between tabs
*/
public class Solution {
public static String getPartOfString(String string) throws StringTooShortException {
if (string == null) throw new StringTooShortException();
if (!string.contains("\\t")) throw new StringTooShortException();
String s = "";
int i = 0;
while (s.indexOf("\\t") > 0) {
i = s.indexOf("\\t");
String result = s.substring(i, i + 1);
return result;
}
return s;
}
public static class StringTooShortException extends Exception {
}
public static void main(String[] args) throws StringTooShortException {
System.out.println(getPartOfString("\tCodeGym is the best place \tto learn Java\t."));
}
}