@Test public void testRemoveTrailingAndLeadingWhitespaces() { ConvertString convertString = new ConvertString(); String inputData = " " + expected; for (String removechar : convertString.WHITESPACE_CHARS) { inputData = inputData + removechar; } Assert.assertEquals(expected, convertString.removeTrailingAndLeadingWhitespaces(inputData)); }
public String removeTrailingAndLeadingWhitespaces(String input) { if (StringUtils.isEmpty(input)) { return input; } String result = input; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; }
ConvertString { public String removeTrailingAndLeadingWhitespaces(String input) { if (StringUtils.isEmpty(input)) { return input; } String result = input; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; } }
ConvertString { public String removeTrailingAndLeadingWhitespaces(String input) { if (StringUtils.isEmpty(input)) { return input; } String result = input; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; } ConvertString();  ConvertString(String repeatStr); }
ConvertString { public String removeTrailingAndLeadingWhitespaces(String input) { if (StringUtils.isEmpty(input)) { return input; } String result = input; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; } ConvertString();  ConvertString(String repeatStr); String removeTrailingAndLeadingWhitespaces(String input); String removeTrailingAndLeading(String input); String removeTrailingAndLeading(String input, String character); String removeRepeatedChar(String input); String removeRepeatedWhitespaces(String input); }
ConvertString { public String removeTrailingAndLeadingWhitespaces(String input) { if (StringUtils.isEmpty(input)) { return input; } String result = input; while (StringUtils.startsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeStart(result, result.substring(0, 1)); } while (StringUtils.endsWithAny(result, WHITESPACE_CHARS)) { result = StringUtils.removeEnd(result, result.substring(result.length() - 1, result.length())); } return result; } ConvertString();  ConvertString(String repeatStr); String removeTrailingAndLeadingWhitespaces(String input); String removeTrailingAndLeading(String input); String removeTrailingAndLeading(String input, String character); String removeRepeatedChar(String input); String removeRepeatedWhitespaces(String input); static final String[] WHITESPACE_CHARS; }