Compatibility
Minecraft: Java Edition
1.21.x
Platforms
Data Pack
Supported environments
90% of ad revenue goes to creators
Support creators and Modrinth ad-free with Modrinth+Links
Creators
Details
Licensed MIT
Published last month
Updated 2 weeks ago
StringLib
A Minecraft Data Pack library that offers highly optimized implementations for many useful string manipulation utilities.
Download: Modrinth
For inquiries, please contact @silicatYT on Discord.
Features
concat
: Combine an arbitrary number of strings into a single string.- Example:
["123","456","789]
→"123456789"
- Example:
find
: Get a list of indexes for instances of a string. You can also go in reverse and limit the number of results.- Example:
{String:"Looking for the last 'o' in this sentence", Find:"o", n:-1}
→[22]
- Example:
replace
: Replace instances of a string with another string. You can also go in reverse and limit the number of replacements.- Example:
{String:"Bad example", Find:"Bad", Replace:"Great"}
→"Great example"
- Example:
to_uppercase / to_lowercase
: Convert a string to uppercase or lowercase. Choose between a fast and a full version, the latter supporting the entire Unicode range.- Example:
"This is uppercase"
→"THIS IS UPPERCASE"
- Example:
insert
: Insert a string at a specific index.- Example:
{String:"This is cool", Insertion:" really", Index:7}
→"This is really cool"
- Example:
to_string
: Convert any data storage entry to a string.- Example:
127b
→"127"
- Example:
to_number
: Convert a stringified number to a number.- Example:
"512"
→512
- Example:
split
: Split a string into multiple, based on a separator character or string. Decide whether to keep or remove empty strings.- Example:
"Hello World"
→["Hello", "World]
- Example:
- and more to come!
How to use
You can find the utility functions in stringlib:util/...
. In each function, there is a detailed guide for how to use it, along with a list of all the parameters.
Credit
From CMDred:
- SilicatYT
Good to know
- If you no longer need StringLib or want to upgrade to a newer version, you can run
/function stringlib:uninstall
to remove all the data storage and scoreboard entries.
License
As per the MIT License, you are allowed to redistribute, modify and use StringLib as long as we are credited for the original work.