Skript: <string> split at <string> doesn't work; while split <string> at <string> works

Created on 11 Jul 2017  路  5Comments  路  Source: SkriptLang/Skript

The syntax <string> split at <string> doesn't work when splitting an explicit string, such as
set {_test::*} to "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" split at ","

However, using the alternative syntax split <string> at <string> such as
set {_test::*} to split "Monday,Tuesday,Wednesday,Thursday,Friday,Saturday,Sunday" at ","

or a string variable
set {_test::*} to {_weekdays} split at ","

works.

bug medium

Most helpful comment

you can surround the string in () like ("Abc") to fix this, credit to @Blueyescat for finding the workaround. Maybe that will help you if you work on this issue @bensku

All 5 comments

I can confirm this, for some reason, the first pattern doesn't accept literals.

That's interesting, I've never been able to split string literals because I always use the first syntax and I assumed it was just a limitation of the expression for whatever reason.

Hmm, this is weird... I hope it is just a typo and no spaghetti parser bug.

more info on this: it happens any time a string literal is the start of a pattern. Even if you don't take in a literal string, for example, %objects% wont init and in my script I put "string" wont init, my expression will never have init called.

you can surround the string in () like ("Abc") to fix this, credit to @Blueyescat for finding the workaround. Maybe that will help you if you work on this issue @bensku

Was this page helpful?
0 / 5 - 0 ratings