Here you can find the source of startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix)
Parameter | Description |
---|---|
testee | a parameter |
firstPrefix | a parameter |
secondPrefix | a parameter |
public static boolean startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix)
//package com.java2s; //License from project: Open Source License public class Main { /**// w w w. j a v a 2 s. c o m * Equivalent to testee.startsWith(firstPrefix + secondPrefix) but avoids * creating an object for concatenation. * * @param testee * @param firstPrefix * @param secondPrefix * @return */ public static boolean startsWithConcatenationOf(String testee, String firstPrefix, String secondPrefix) { int l1 = firstPrefix.length(); int l2 = secondPrefix.length(); if (testee.length() < l1 + l2) return false; return testee.startsWith(firstPrefix) && testee.regionMatches(l1, secondPrefix, 0, l2); } }