Android examples for java.lang:String Starts or Ends
Get the whitespace that is the prefix of the given text
public class Main{ /** Get the whitespace that is the prefix of the given text */ public static String getIndent(String text) { String ret = ""; char chTemp; String strTemp;/*from w w w . ja v a 2s . c om*/ boolean boolA, boolB; for (int i = 0; i < text.length(); i++) { boolA = false; boolB = false; chTemp = text.charAt(i); strTemp = String.valueOf(chTemp); boolA = strTemp.equals(ASPACE); boolB = strTemp.equals(ATAB); if (boolA || boolB) ret += strTemp; else return ret; } return ret; } }