String Utilities Mod
This modification significantly expands the capabilities for working with NBT data strings in Minecraft, providing a comprehensive set of tools for processing textual information.
Core Command Syntax
/string <method> [target] [source...]
The target and source parameters function similarly to the syntax of the data modify command, making the mod intuitive for experienced users.
Usage Examples
- Empty string check:
/string isEmpty value ""returns 1 - Non-existent element search:
/string indexOf value "asdfghjkl" value "qwerty"returns -1 - Special character escaping:
/string escape storage a:b c value '\'quote"slash\'writes'quote\"slash\to the specified storage location - Space removal:
/string strip storage foo:bar baz value " a 123 "storesa 123in the designated location - Identifier concatenation:
/string concat2 storage a b from entity @s SelectedItem.id from entity @s Inventory[0].id - UUID formation:
/string join storage test playerUUID from value "~" from @s UUID
Available String Processing Methods
Validation Operations
isBlank - checks if a string contains only whitespace characters isEmpty - determines if a string is completely empty length - returns the length of the string in characters
Core Transformations
toString - converts any NBT element to string format escape - escapes special characters in strings trim, trimStart, trimEnd - removes whitespace from both sides, only left, or only right strip, stripLeading, stripTrailing - alternative methods for whitespace removal
Case and Encoding
toLowerCase, toUpperCase - converts string to lowercase or uppercase toCharArray - splits string into individual characters as a list toCodePoints, fromCodePoints - Unicode character operations toCodePointStrings - breaks string into Unicode characters
String Operations
concat, concat2 - merging multiple strings into one repeat - repeating a string a specified number of times substring, substring2 - extracting substrings by indices split - splitting string into parts by specified separator
Search and Replace
indexOf, lastIndexOf - finding substring position startsWith, endsWith - checking string start and end contains - determining substring presence matches, matchesAll, matchesAllFully - regular expression searches replace, replaceAll, replaceFirst - text replacement in strings
Additional Functions
at - getting character at specified index join - joining list elements into string with delimiter escapeNbt, escapeRegex - specialized escaping methods
Many methods automatically convert any NBT data types to string format before performing operations, making them versatile in usage.