Java String Ends With endsWithSingleQuoteS(String s)

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

Description

True if string ends with "single quote + s".

License

Open Source License

Parameter

Parameter Description
s String to check for ending with single quote + s.

Return

true if token ends with single quote + s.

Declaration


public static boolean endsWithSingleQuoteS(String s) 

Method Source Code

//package com.java2s;
/*   Please see the license information at the end of this file. */

public class Main {
    /**   Left single curly quote. */

    public static final char LSQUOTE = '\u2018';
    /**   Right single curly quote. */

    public static final char RSQUOTE = '\u2019';

    /**   True if string ends with "single quote + s".
     *//from  w ww. j ava2 s  .  c o m
     *   @param   s   String to check for ending with single quote + s.
     *
     *   @return      true if token ends with single quote + s.
     */

    public static boolean endsWithSingleQuoteS(String s) {
        int l = s.length();

        return (l > 1) && ((s.charAt(l - 1) == 's') || (s.charAt(l - 1) == 'S')) && isSingleQuote(s.charAt(l - 2));
    }

    /**   True if character is single quote.
     *
     *   @param   c   Character to check for being a single quote.
     *
     *   @return      true if character is a single quote.
     */

    public static boolean isSingleQuote(char c) {
        return (c == '\'') || (c == LSQUOTE) || (c == RSQUOTE);
    }
}

Related

  1. endsWithOneOf(String value, String... ends)
  2. endsWithoutPathSeparator(final String path)
  3. endsWithoutSlash(String url)
  4. endsWithSentenceSeparator(char[] token)
  5. endsWithSeparator(String str)
  6. endsWithSlash(final String path)
  7. endsWithSomeChar(char cs[], String activationToken)
  8. endsWithSpace(String s)
  9. endsWithSpaces(final String text)