Java String Starts Wtih startsWith(StringBuilder builder, String prefix, int offset)

Here you can find the source of startsWith(StringBuilder builder, String prefix, int offset)

Description

Does the builder start with prefix?

License

Open Source License

Parameter

Parameter Description
builder a parameter
prefix a parameter
offset a parameter

Return

boolean

Declaration

public static boolean startsWith(StringBuilder builder, String prefix, int offset) 

Method Source Code

//package com.java2s;
/*  Copyright 2011 Alexander Bunkenburg alex@inspiracio.com
    //www  . j a va  2  s  .c o  m
This file is part of atom.jar.
    
atom.jar is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
    
atom.jar is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.
    
You should have received a copy of the GNU General Public License
along with atom.jar.  If not, see <http://www.gnu.org/licenses/>.
 */

public class Main {
    /** Does the builder start with prefix? 
     * @param builder
     * @param prefix 
     * @return boolean */
    public static boolean startsWith(StringBuilder builder, String prefix) {
        boolean startsWith = builder.indexOf(prefix) == 0;
        return startsWith;
    }

    /** Does the builder start with prefix? 
     * @param builder
     * @param prefix 
     * @param offset
     * @return boolean */
    public static boolean startsWith(StringBuilder builder, String prefix, int offset) {
        int i = builder.indexOf(prefix, offset);
        boolean startsWith = i == offset;
        return startsWith;
    }
}

Related

  1. startsWith(String[] array, String obj)
  2. startsWith(String[] beginningSegments, String[] testSegments)
  3. startsWith(String[] searchStrings, String text)
  4. startsWith(String[] target, String[] with)
  5. startsWith(StringBuffer buffer, String prefix)
  6. startsWith(StringBuilder sb, String prefix)
  7. startsWith(T[] arr, T[] prefix)
  8. startsWith4(String string, int startIndex, int char1, int char2, int char3, int char4)
  9. startsWithAcronym(String word)