X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2Futil%2FStringUtil.java;h=7d8009d0498498ccb12e7695253da7de5d17ad9f;hb=f09d2abb95f106197aea99c345282c3bf0cd3717;hp=5e39447c08737ad0b5e6fdd6f6886a1577d6eed1;hpb=927dc9b785de472f2237c5adbc4d2ad12f16cc2d;p=sbp.git diff --git a/src/edu/berkeley/sbp/util/StringUtil.java b/src/edu/berkeley/sbp/util/StringUtil.java index 5e39447..7d8009d 100644 --- a/src/edu/berkeley/sbp/util/StringUtil.java +++ b/src/edu/berkeley/sbp/util/StringUtil.java @@ -3,6 +3,10 @@ package edu.berkeley.sbp.util; /** miscellaneous string utilities */ public class StringUtil { + public static String pad(int i,String s) { + return s.length() >= i ? s : pad(i-1,s)+" "; + } + public static String join(String[] s, String sep) { StringBuffer ret = new StringBuffer(); for(int i=0; i= 127) { + sb.append("\\x"+((int)c)); + } else { + sb.append(c); + } } return sb.toString(); } + + public static String indent(String s, int indent) { + if (s.indexOf('\n')==-1) return s; + StringBuffer ret = new StringBuffer(); + for(int i=0; i