Java String Ends With endsWithWhitespace(final CharSequence charSeq)

Here you can find the source of endsWithWhitespace(final CharSequence charSeq)

Description

Finds out if the given character sequence ends with a whitespace character.

License

Open Source License

Return

true if the given character sequence is not empty and ends with a whitespace character; false otherwise

Declaration

public static boolean endsWithWhitespace(final CharSequence charSeq) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**/*from w w  w  . ja v a 2  s.  c om*/
     * Finds out if the given character sequence ends with a whitespace
     * character.
     *
     * @return  {@code true} if the given character sequence is not empty
     *          and ends with a whitespace character; {@code false} otherwise
     * @exception  NullPointerException  if the given character sequence is
     *             {@code null}
     */
    public static boolean endsWithWhitespace(final CharSequence charSeq) {
        if (charSeq.length() == 0) {
            return false;
        }
        return Character.isWhitespace(charSeq.charAt(charSeq.length() - 1));
    }
}

Related

  1. endsWithSpace(String s)
  2. endsWithSpaces(final String text)
  3. endsWithStarsPattern(String text, int from)
  4. endsWithStartOfOther(String text, String textOther)
  5. endsWithStop(String str)
  6. endsWithWhitespace(String s)
  7. endsWithWord(StringBuffer strBuf, int endIndex, int lastSpaceIndex)