2018-04-07 03:58:48 +00:00
|
|
|
/*
|
|
|
|
* Minecraft Forge
|
2019-02-10 22:57:03 +00:00
|
|
|
* Copyright (c) 2016-2019.
|
2018-04-07 03:58:48 +00:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
*/
|
|
|
|
|
2018-06-11 01:12:46 +00:00
|
|
|
package net.minecraftforge.fml.loading;
|
2018-04-07 03:58:48 +00:00
|
|
|
|
2018-06-06 15:37:56 +00:00
|
|
|
import org.apache.commons.lang3.text.StrSubstitutor;
|
|
|
|
|
|
|
|
import java.net.MalformedURLException;
|
|
|
|
import java.net.URL;
|
2018-09-29 01:07:46 +00:00
|
|
|
import java.util.Locale;
|
2018-06-06 15:37:56 +00:00
|
|
|
import java.util.Map;
|
|
|
|
|
2018-04-07 03:58:48 +00:00
|
|
|
public class StringUtils
|
|
|
|
{
|
|
|
|
public static String toLowerCase(final String str) {
|
2018-09-29 01:07:46 +00:00
|
|
|
return str.toLowerCase(Locale.ROOT);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toUpperCase(final String str) {
|
|
|
|
return str.toUpperCase(Locale.ROOT);
|
2018-04-07 03:58:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean endsWith(final String search, final String... endings) {
|
|
|
|
String lowerSearch = toLowerCase(search);
|
|
|
|
return java.util.stream.Stream.of(endings).anyMatch(lowerSearch::endsWith);
|
|
|
|
}
|
2018-06-06 15:37:56 +00:00
|
|
|
|
|
|
|
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<String, String> properties) {
|
|
|
|
return StrSubstitutor.replace(input, properties);
|
|
|
|
}
|
2018-04-07 03:58:48 +00:00
|
|
|
}
|