Here you can find the source of trimKeyFormat(String s3KeyFormat, List
public static String trimKeyFormat(String s3KeyFormat, List<String> disallowedKeys)
//package com.java2s; //License from project: Apache License import java.util.List; public class Main { public static String trimKeyFormat(String s3KeyFormat, List<String> disallowedKeys) { int lowestIndex = s3KeyFormat.length(); for (String disallowedKey : disallowedKeys) { int index = s3KeyFormat.indexOf(disallowedKey); if (index != -1 && index < lowestIndex) { lowestIndex = index;/*w w w . j a va 2s . c om*/ } } if (lowestIndex == -1) { return s3KeyFormat; } return s3KeyFormat.substring(0, lowestIndex); } }