StringLib
A Minecraft Data Pack library that offers highly optimized implementations for many useful string manipulation utilities.
介绍
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" 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] 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" 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" insert: Insert a string at a specific index.- Example:
{String:"This is cool", Insertion:" really", Index:7}→"This is really cool" to_string: Convert any data storage entry to a string.- Example:
127b→"127" to_number: Convert a stringified number to a number.- Example:
"512"→512 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] - 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:uninstallto 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.
常见问题
StringLib 支持哪些 Minecraft 版本?
StringLib 支持 Minecraft Java 版 1.21–1.21.8,共 9 个版本。下载时注意选择和你游戏版本一致的文件。
StringLib 怎么安装?
新建世界时在「数据包」里把下载的 .zip 拖进去;已有的存档,把文件放进存档目录下的 datapacks 文件夹,进游戏输入 /reload 即可生效。服务器同样放在世界目录的 datapacks 里。
SilicatYT 的其他作品
查看全部 →
TimeLib
Get the real life date & time tick-perfectly and efficiently!
ForceloadLib
A Minecraft Data Pack library that adds various useful features related to forceloading chunks.
ScoreFixer
Prevent scores from getting lost after player name changes.
Per-Player Displays
A Minecraft Data Pack library for player-specific display entities.
评论
登录后评论和评分