Here you can find the source of removeModuleReference(String allStr, String refStr)
Parameter | Description |
---|---|
allStr | the RefSource. |
refStr | the removing reference. |
public static String removeModuleReference(String allStr, String refStr)
//package com.java2s; import java.util.ArrayList; import java.util.Arrays; public class Main { /**/*from w w w . j a v a 2 s. co m*/ * the separator string of references. */ private static final String REFERENCE_SEPARATOR_NAME = ";"; /** * Removes reference from RefSource and returns the new references. * * @param allStr * the RefSource. * @param refStr * the removing reference. * @return the new references. */ public static String removeModuleReference(String allStr, String refStr) { ArrayList<String> orgList = null; if (allStr != null) { orgList = new ArrayList<String>(Arrays.asList(allStr.split(REFERENCE_SEPARATOR_NAME))); } else { orgList = new ArrayList<String>(); } if (orgList.contains(refStr)) { orgList.remove(refStr); } return makeModuleReference(orgList); } /** * Returns the RefSource attribute value. * * @param list * the reference list. * @return the RefSource attribute value. */ private static String makeModuleReference(ArrayList<String> list) { StringBuffer buffer = new StringBuffer(); for (String attr : list) { if (buffer.length() > 0) { buffer.append(REFERENCE_SEPARATOR_NAME); } buffer.append(attr); } return buffer.toString(); } }