From 064c0dc0cfab1cc677dfffc4b3b56642017e412b Mon Sep 17 00:00:00 2001 From: Alkalus <3060479+draknyte1@users.noreply.github.com> Date: Fri, 8 Mar 2019 03:14:13 +0000 Subject: + Added some AgriChem. (You can now use Raw waste as a fuel source) + Added OreDict names to vanilla items, as was done in Forge 1.8.9. + Added functions to allow other mods to add Semifluid Fuels. + Added functions to handle String data into StringUtils.java. % Renamed getItemStack -> getItemStackFromFQRN. $ Fixed handling of custom cells for fluids using '.' within their names. $ Fixed HF exploit. --- .../gtPlusPlus/core/util/data/StringUtils.java | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/Java/gtPlusPlus/core/util/data') diff --git a/src/Java/gtPlusPlus/core/util/data/StringUtils.java b/src/Java/gtPlusPlus/core/util/data/StringUtils.java index b64266b5d4..2821a0c1c9 100644 --- a/src/Java/gtPlusPlus/core/util/data/StringUtils.java +++ b/src/Java/gtPlusPlus/core/util/data/StringUtils.java @@ -1,5 +1,7 @@ package gtPlusPlus.core.util.data; +import gtPlusPlus.api.objects.data.AutoMap; + public class StringUtils { public static String superscript(String str) { @@ -131,4 +133,42 @@ public class StringUtils { return aData; } } + + public static String splitAndUppercase(String aInput, String aDelim) { + String[] aSplit = aInput.split(aDelim); + if (aSplit == null || aSplit.length == 0) { + return aInput; + } + else { + AutoMap aTemp = new AutoMap(); + for (String s : aSplit) { + aTemp.put(firstLetterCaps(s)); + } + String aReturn = ""; + for (String s : aTemp) { + aReturn += s; + } + return aReturn; + } + } + + public static int characterCount(String aString, char aChar) { + return characterCount(aString, ""+aChar); + } + + public static int characterCount(String aString, String aChar) { + int aLength = aString.length(); + int aFound = 0; + if (aLength == 0 || !aString.contains(aChar)) { + return 0; + } + else { + for (int index = 0; index < aLength; index++) { + if (aString.substring(index, index+1).equals(aChar)) { + aFound++; + } + } + return aFound; + } + } } -- cgit