Here you can find the source of startsWithWhitespace(String s)
public static boolean startsWithWhitespace(String s)
//package com.java2s; /*//from ww w .j a v a2 s . c o m * This file is part of the Jose Project * see http://jose-chess.sourceforge.net/ * (c) 2002-2006 Peter Sch?fer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * */ public class Main { public static boolean startsWithWhitespace(String s) { return (s.length() > 0) && Character.isWhitespace(s.charAt(0)); } public static final int length(Object string) { if (string instanceof String) return ((String) string).length(); if (string instanceof StringBuffer) return ((StringBuffer) string).length(); throw new IllegalArgumentException("expecting String or StringBuffer"); } public static boolean isWhitespace(String s) { if (s == null) return false; for (int i = s.length() - 1; i >= 0; i--) { char c = s.charAt(i); if (!Character.isWhitespace(c)) return false; } return true; } }