Class StringUtil
java.lang.Object
com.blamejared.crafttweaker.api.util.StringUtil
Basic String utils exposed to ZenScript and for use in Java code.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanmatchesRegex(String string, String regex) Checks if the given string matches the given regular expressionstatic StringquoteAndEscape(String str) Quotes the given String in double quotes (") and escapes any control character.static StringquoteAndEscape(net.minecraft.resources.ResourceLocation location) Quotes the given ResourceLocation in double quotes (") and escapes any control character.static StringWraps the given String in another String and also optionally escapes control characters in the String.
-
Constructor Details
-
StringUtil
public StringUtil()
-
-
Method Details
-
matchesRegex
Checks if the given string matches the given regular expression- Parameters:
string- String to checkregex- Regex to check against- Returns:
- True if the string matches. False otherwise
-
quoteAndEscape
Quotes the given ResourceLocation in double quotes (") and escapes any control character.- Parameters:
location- ResourceLocation to quote and escape.- Returns:
- a new String with the ResourceLocation quoted and escaped.
-
quoteAndEscape
Quotes the given String in double quotes (") and escapes any control character.- Parameters:
str- String to quote and escape.- Returns:
- a new String with the String quoted and escaped.
-
wrap
Wraps the given String in another String and also optionally escapes control characters in the String.- Parameters:
str- String to wrapwith- String to wrap withescape- Should control characters be escaped- Returns:
- a new String that is wrapped with the given String and optioanlly escaped.
-