Java String Ends With endsWithIgnoreCase(String baseString, String compareString)

Here you can find the source of endsWithIgnoreCase(String baseString, String compareString)

Description

endsWithIgnoreCase

License

LGPL

Declaration

public static boolean endsWithIgnoreCase(String baseString, String compareString) 

Method Source Code

//package com.java2s;
/**/*w  w w.j av  a  2s .  co m*/
* Converts a line of text into an array of lower case words using a
* BreakIterator.wordInstance().
* <p>
* 
* This method is under the Jive Open Source Software License and was written
* by Mark Imbriaco.
* 
* @param text
*          a String of text to convert into an array of words
* @return text broken up into an array of words.
*/

public class Main {
    /**
    * endsWithIgnoreCase
    */
    public static boolean endsWithIgnoreCase(String baseString, String compareString) {
        if (baseString == null)
            return false;
        else
            return baseString.toUpperCase().endsWith(compareString.toUpperCase());
    }

    /**
    * endWith
    */
    public static boolean endsWith(String baseString, String compareString) {
        if (baseString == null)
            return false;
        else
            return baseString.endsWith(compareString);
    }

    public static char toUpperCase(char c) {
        return Character.toUpperCase(c);
    }

    public static String toUpperCase(String s) {
        if (s == null)
            return null;
        else {
            return s.toUpperCase();
            /*
            * StringBuffer stringbuffer = new StringBuffer(); for(int i = 0; i <
            * s.length(); i++) stringbuffer.append(toUpperCase(s.charAt(i)));
            * 
            * return stringbuffer.toString();
            */
        }
    }
}

Related

  1. endsWithIgnoreCase(final String text, final String suffix)
  2. endsWithIgnoreCase(final String text, final String suffix)
  3. endsWithIgnoreCase(final String text, final String suffix)
  4. endsWithIgnoreCase(Object string, Object suffix)
  5. endsWithIgnoreCase(String a, String b)
  6. endsWithIgnoreCase(String haystack, String needle)
  7. endsWithIgnoreCase(String input, String suffix)
  8. endsWithIgnoreCase(String input, String... suffixes)
  9. endsWithIgnoreCase(String name, Iterable patterns)