TransWikia.com

Test if an nbt string contains another nbt string

Arqade Asked on August 31, 2021

Story

So I’m trying to make a searching system in Minecraft 1.16, and need to be able to get search results. To get search results, I can test if the search query is contained in any of the possibilities, and add all the search possibilities that had the search query contained in it to an array for processing and whatever. That is where I’m stuck. I don’t know how to test if a string is contained in another string.

What I’ve tried

I’ve thought about splitting the search query and search possibilities into 1 character strings stored in an array. So this is what one of the split strings should look like. [“s”,”e”,”a”,”r”,”c”,”h”]. Then after that I loop through one of the possibility’s array, testing for a sequence that is our search query array. The only problem is that I don’t know how to split strings in Minecraft. ExpertCoder14’s question was the only thing I could find about splitting strings. If you do solve my problem with splitting strings, then please answer the following question on the splitting strings.

How to split an NBT string into two strings?

Your Task

Find how to split a string, or find another way to test if a string is contained in another string.

Update: I have found a datapack for string manipulation, and will see if it will work.

Update: The datapack I found works, and I am working on a tool that will do what I was trying to do. Just know that my tool is coming soon!

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP