Here you can find the source of getIndent(String text)
public static String getIndent(String text)
//package com.java2s; public class Main { public static final String ATAB = String.valueOf('\u0009'); public static final String ASPACE = " "; /** 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 2 s.c o m 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; } //TODO: TestInfo.testWriteLn("Indent: " + ret); return ret; } }