Here you can find the source of startsWith(char s[], int len, String prefix)
Parameter | Description |
---|---|
s | Input Buffer |
len | length of input buffer |
prefix | Prefix string to test |
s
starts with prefix
public static boolean startsWith(char s[], int len, String prefix)
//package com.java2s; /*// ww w.j a va 2s .co m * Carrot2 project. * * Copyright (C) 2002-2016, Dawid Weiss, Stanis?aw Osi?ski. * All rights reserved. * * Refer to the full license file "carrot2.LICENSE" * in the root folder of the repository checkout or at: * http://www.carrot2.org/carrot2.LICENSE */ public class Main { /** * Returns true if the character array starts with the suffix. * * @param s Input Buffer * @param len length of input buffer * @param prefix Prefix string to test * @return true if <code>s</code> starts with <code>prefix</code> */ public static boolean startsWith(char s[], int len, String prefix) { final int prefixLen = prefix.length(); if (prefixLen > len) return false; for (int i = 0; i < prefixLen; i++) if (s[i] != prefix.charAt(i)) return false; return true; } }