/* * Minecraft Forge * Copyright (c) 2016-2019. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation version 2.1 * of the License. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ package net.minecraftforge.fml.loading; import org.apache.commons.lang3.text.StrSubstitutor; import java.net.MalformedURLException; import java.net.URL; import java.util.Locale; import java.util.Map; public class StringUtils { public static String toLowerCase(final String str) { return str.toLowerCase(Locale.ROOT); } public static String toUpperCase(final String str) { return str.toUpperCase(Locale.ROOT); } public static boolean endsWith(final String search, final String... endings) { String lowerSearch = toLowerCase(search); return java.util.stream.Stream.of(endings).anyMatch(lowerSearch::endsWith); } public static URL toURL(final String string) { try { return new URL(string); } catch (MalformedURLException e) { throw new RuntimeException(e); } } public static String parseStringFormat(final String input, final Map properties) { return StrSubstitutor.replace(input, properties); } }