Here you can find the source of containsPrefix(String str, Collection prefixes)
Parameter | Description |
---|---|
str | a parameter |
prefixes | a collection of String objects |
public static boolean containsPrefix(String str, Collection prefixes)
//package com.java2s; //License from project: LGPL import java.util.Collection; import java.util.Iterator; public class Main { /**//www. j ava 2 s . c o m * if str starts with a prefix which is included in prefixes collection * return true, otherwise return false. * * @param str * @param prefixes * a collection of String objects * * @return if str starts with a prefix which is included in prefixes collection * return true, otherwise return false. */ public static boolean containsPrefix(String str, Collection prefixes) { if (str != null && prefixes != null) { Iterator it = prefixes.iterator(); while (it.hasNext()) { String prefix = (String) it.next(); if (str.startsWith(prefix)) { return true; } } } return false; } }