@Test public void testTab() { StringBuilder sb = new StringBuilder("123"); Format.tab(sb, 2, false); assertThat(sb.toString()).isEqualTo("123"); sb = new StringBuilder("123"); Format.tab(sb, 2, true); assertThat(sb.toString()).isEqualTo("123 "); sb = new StringBuilder("123"); Format.tab(sb, 6, false); assertThat(sb.toString()).isEqualTo("123 "); sb = new StringBuilder("123"); Format.tab(sb, 6, true); assertThat(sb.toString()).isEqualTo("123 "); }
public static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne) { int len = sbuff.length(); if (tabStop > len) { sbuff.setLength(tabStop); for (int i = len; i < tabStop; i++) { sbuff.setCharAt(i, ' '); } } else if (alwaysOne) { sbuff.setLength(len + 1); sbuff.setCharAt(len, ' '); } }
Format { public static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne) { int len = sbuff.length(); if (tabStop > len) { sbuff.setLength(tabStop); for (int i = len; i < tabStop; i++) { sbuff.setCharAt(i, ' '); } } else if (alwaysOne) { sbuff.setLength(len + 1); sbuff.setCharAt(len, ' '); } } }
Format { public static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne) { int len = sbuff.length(); if (tabStop > len) { sbuff.setLength(tabStop); for (int i = len; i < tabStop; i++) { sbuff.setCharAt(i, ' '); } } else if (alwaysOne) { sbuff.setLength(len + 1); sbuff.setCharAt(len, ' '); } }  }
Format { public static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne) { int len = sbuff.length(); if (tabStop > len) { sbuff.setLength(tabStop); for (int i = len; i < tabStop; i++) { sbuff.setCharAt(i, ' '); } } else if (alwaysOne) { sbuff.setLength(len + 1); sbuff.setCharAt(len, ' '); } }  static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne); static String s(String s, int width); static String pad(String s, int width, boolean rightJustify); static String i(int v, int width); static String l(long v, int width); static String d(double d, int min_sigfig); static String d(double d, int min_sigfig, int width); static String dfrac(double d, int fixed_decimals); static String formatDouble(double d, int min_sigFigs, int fixed_decimals); static String formatByteSize(double size); }
Format { public static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne) { int len = sbuff.length(); if (tabStop > len) { sbuff.setLength(tabStop); for (int i = len; i < tabStop; i++) { sbuff.setCharAt(i, ' '); } } else if (alwaysOne) { sbuff.setLength(len + 1); sbuff.setCharAt(len, ' '); } }  static void tab(StringBuilder sbuff, int tabStop, boolean alwaysOne); static String s(String s, int width); static String pad(String s, int width, boolean rightJustify); static String i(int v, int width); static String l(long v, int width); static String d(double d, int min_sigfig); static String d(double d, int min_sigfig, int width); static String dfrac(double d, int fixed_decimals); static String formatDouble(double d, int min_sigFigs, int fixed_decimals); static String formatByteSize(double size);  }