2015-08-29 14:33:25 +02:00
|
|
|
/*
|
|
|
|
* This file ("StringUtil.java") is part of the Actually Additions Mod for Minecraft.
|
|
|
|
* It is created and owned by Ellpeck and distributed
|
|
|
|
* under the Actually Additions License to be found at
|
|
|
|
* http://github.com/Ellpeck/ActuallyAdditions/blob/master/README.md
|
|
|
|
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
|
|
|
*
|
2015-11-02 20:55:19 +01:00
|
|
|
* © 2015 Ellpeck
|
2015-08-29 14:33:25 +02:00
|
|
|
*/
|
|
|
|
|
2015-03-29 15:29:05 +02:00
|
|
|
package ellpeck.actuallyadditions.util;
|
|
|
|
|
2015-08-01 00:40:29 +02:00
|
|
|
import net.minecraft.util.StatCollector;
|
|
|
|
|
2015-11-03 23:27:24 +01:00
|
|
|
import java.util.Locale;
|
2015-08-24 17:57:11 +02:00
|
|
|
import java.util.Objects;
|
|
|
|
|
2015-03-29 15:29:05 +02:00
|
|
|
public class StringUtil{
|
|
|
|
|
|
|
|
public static final int DECIMAL_COLOR_WHITE = 16777215;
|
2015-04-19 01:50:02 +02:00
|
|
|
public static final int DECIMAL_COLOR_GRAY_TEXT = 4210752;
|
2015-03-29 15:29:05 +02:00
|
|
|
|
2015-11-23 19:06:07 +01:00
|
|
|
public static final String BUGGED_ITEM_NAME = "lolWutHowUDoDis";
|
|
|
|
|
2015-08-01 00:40:29 +02:00
|
|
|
/**
|
|
|
|
* Localizes a given String via StatCollector
|
|
|
|
*/
|
|
|
|
public static String localize(String text){
|
|
|
|
return StatCollector.translateToLocal(text);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Localizes a given formatted String with the given Replacements
|
|
|
|
*/
|
2015-10-02 16:48:01 +02:00
|
|
|
public static String localizeFormatted(String text, Object... replace){
|
2015-08-01 00:40:29 +02:00
|
|
|
return StatCollector.translateToLocalFormatted(text, replace);
|
|
|
|
}
|
2015-08-24 17:57:11 +02:00
|
|
|
|
2015-10-03 10:19:40 +02:00
|
|
|
public static boolean equalsToLowerCase(String one, String two){
|
|
|
|
return Objects.equals(toLowerCase(one), toLowerCase(two));
|
|
|
|
}
|
|
|
|
|
2015-08-24 17:57:11 +02:00
|
|
|
public static String toLowerCase(String string){
|
2015-10-02 16:48:01 +02:00
|
|
|
if(string == null){
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
else{
|
2015-11-03 23:27:24 +01:00
|
|
|
return string.toLowerCase(Locale.ROOT);
|
2015-10-02 16:48:01 +02:00
|
|
|
}
|
2015-08-24 17:57:11 +02:00
|
|
|
}
|
2015-03-29 15:29:05 +02:00
|
|
|
}
|