Download

How to split a string

Hello! I’m creating a game that uses external data to create the map. I’m designing the level loader, and I want to know how I can make something like this.

My level tile string is:

1,1,1,1,1,1,1,1,1-1,0,0,0,0,0,0,1-1,1,1,1,1,1,1

Now I want to know how I can split the string using a for loop (for example) in blueprints. I want to know if tile 1 is 1 or 0 to spawn different meshes on the map. Any solution?

Thanks!

Pull out of the string and use a parse into array(forstring) and in the delimiter box type a ,

Since each number is separated by a comma

that way when you put that into a for each loop it will give you the read out of each number

if you want to know only tile 1. It should be a get index 0 instead of foreach loop. Or you can use a switch on int out of the foreach loop. It depends on what you want to do.

,” as delimiter.

Thanks, it’s solved using ParseIntoArray 2 times with ForEach loop using “-” as first delimiter in ParseIntoArray and “,” in the second.