Java String Starts Wtih startsWithCharacter(String str, String matchChars)

Here you can find the source of startsWithCharacter(String str, String matchChars)

Description

Check for defined Characters at start of Word or Sequence of words

License

Creative Commons License

Parameter

Parameter Description
str a parameter
matchChars a parameter

Declaration

public static boolean startsWithCharacter(String str, String matchChars) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

public class Main {
    /**//from   w  ww . ja  v  a2 s .co m
     * Check for defined Characters at start of Word or Sequence of words
     * 
     * @param str
     * @param matchChars
     * @return
     */
    public static boolean startsWithCharacter(String str, String matchChars) {
        for (int i = 0; i < str.length(); i++) {
            final char ch = str.charAt(i);
            final int index = matchChars.indexOf(ch);
            if (index != -1) {
                return true;
            } else {
                return false;
            }
        }
        return false;
    }
}

Related

  1. startsWithChar(final String s, final char c)
  2. startsWithChar(String s, char c)
  3. startsWithChar(String string, char prefix)
  4. startsWithChar(String string, int character)
  5. startsWithCharacter(String str, char stringStart)
  6. startsWithCommonPackagePrefix(String inputText)
  7. startsWithConcatenation(String string, String... prefixes)
  8. startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix)
  9. startsWithCS(String a, String b)