Java String Starts Wtih startsWithWhitespace(String s)

Here you can find the source of startsWithWhitespace(String s)

Description

starts With Whitespace

License

Open Source License

Declaration

public static boolean startsWithWhitespace(String s) 

Method Source Code

//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;
    }
}

Related

  1. startsWithVowel(String text)
  2. startsWithVowel(String value)
  3. startsWithVowel(String word)
  4. startsWithWeight(String s1, String s2)
  5. startsWithWhitespace(final CharSequence charSeq)
  6. startsWithWithoutBeingFollowedByLetter(String s, String compareTo)
  7. startsWithWovel(String s)