Solución
solution.tsTypeScript
public class Solution {
public String trim(String text) {
// Tu código aquí
if (text == null || text.isEmpty()) {
return "";
}
int start = 0;
int end = text.length() -1;
while (start <= end && Character.isWhitespace(text.charAt(start))) {
start++;
}
while (end >= start && Character.isWhitespace(text.charAt(end))) {
end--;
}
return text.substring(start, end +1);
}
}
0respuestas