Java String Starts Wtih startsWithIgnoreCase(String baseString, String compareString)

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

Description

startWith

License

LGPL

Declaration

public static boolean startsWithIgnoreCase(String baseString, String compareString) 

Method Source Code

//package com.java2s;
/**//w w w. j av  a2 s  .c o  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 {
    /**
    * startWith
    */
    public static boolean startsWithIgnoreCase(String baseString, String compareString) {
        if (baseString == null || compareString == null)
            return false;
        else
            return baseString.toUpperCase().startsWith(compareString.toUpperCase());
    }

    /**
    * startWith
    */
    public static boolean startsWith(String baseString, String compareString) {
        if (baseString == null || compareString == null)
            return false;
        else
            return baseString.startsWith(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. startsWithIgnoreCase(final String target1, final String target2)
  2. startsWithIgnoreCase(final String text, final String prefix)
  3. startsWithIgnoreCase(final String text, final String prefix)
  4. startsWithIgnoreCase(final String value, final String possiblePrefix)
  5. startsWithIgnoreCase(String a, String b)
  6. startsWithIgnoreCase(String haystack, String needle)
  7. startsWithIgnoreCase(String haystack, String pattern)
  8. startsWithIgnoreCase(String input, String prefix)
  9. startsWithIgnoreCase(String inputValue, String prefix)