@Test public void trim_trailing() { StringOption value = new StringOption("Hello, world! "); StringOptionUtil.trim(value); assertThat(value, is(new StringOption("Hello, world!"))); }
public static void trim(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int length = text.getLength(); int start = 0; int last = length - 1; for (; start <= last; start++) { if (isTrimTarget(bytes[start]) == false) { break; } } for (; last >= start; last--) { if (isTrimTarget(bytes[last]) == false) { break; } } if (start == 0 && last == length - 1) { return; } text.set(bytes, start, last + 1 - start); }
StringOptionUtil { public static void trim(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int length = text.getLength(); int start = 0; int last = length - 1; for (; start <= last; start++) { if (isTrimTarget(bytes[start]) == false) { break; } } for (; last >= start; last--) { if (isTrimTarget(bytes[last]) == false) { break; } } if (start == 0 && last == length - 1) { return; } text.set(bytes, start, last + 1 - start); } }
StringOptionUtil { public static void trim(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int length = text.getLength(); int start = 0; int last = length - 1; for (; start <= last; start++) { if (isTrimTarget(bytes[start]) == false) { break; } } for (; last >= start; last--) { if (isTrimTarget(bytes[last]) == false) { break; } } if (start == 0 && last == length - 1) { return; } text.set(bytes, start, last + 1 - start); } private  StringOptionUtil(); }
StringOptionUtil { public static void trim(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int length = text.getLength(); int start = 0; int last = length - 1; for (; start <= last; start++) { if (isTrimTarget(bytes[start]) == false) { break; } } for (; last >= start; last--) { if (isTrimTarget(bytes[last]) == false) { break; } } if (start == 0 && last == length - 1) { return; } text.set(bytes, start, last + 1 - start); } private  StringOptionUtil(); static int countCodePoints(StringOption option); static Reader asReader(StringOption option); static void trim(StringOption option); static void append(StringOption target, StringOption contents); static void append(StringOption target, String contents); static void append(StringBuilder target, StringOption contents); static int parseInt(StringOption contents); static long parseLong(StringOption contents); static BigDecimal parseDecimal(StringOption contents); static void append(
            CharBuffer source, StringOption destination,
            CharsetEncoder encoder, ByteBuffer buffer); }
StringOptionUtil { public static void trim(StringOption option) { Text text = option.get(); byte[] bytes = text.getBytes(); int length = text.getLength(); int start = 0; int last = length - 1; for (; start <= last; start++) { if (isTrimTarget(bytes[start]) == false) { break; } } for (; last >= start; last--) { if (isTrimTarget(bytes[last]) == false) { break; } } if (start == 0 && last == length - 1) { return; } text.set(bytes, start, last + 1 - start); } private  StringOptionUtil(); static int countCodePoints(StringOption option); static Reader asReader(StringOption option); static void trim(StringOption option); static void append(StringOption target, StringOption contents); static void append(StringOption target, String contents); static void append(StringBuilder target, StringOption contents); static int parseInt(StringOption contents); static long parseLong(StringOption contents); static BigDecimal parseDecimal(StringOption contents); static void append(
            CharBuffer source, StringOption destination,
            CharsetEncoder encoder, ByteBuffer buffer); static final Charset ENCODING; }