Yeah, I’ve not been able to get the split() method to work either.
My basic method is to use slice() to get only the target substring or value I need, e.g., MyString.slice(0, MyString.indexOf('TargetSub')). The slice() function does not alter the string, so if I need to actually extract and remove substrings, I then use substring() or replace() to remove the target substring. E.g., MyString.replace('TargetSub', '').
See this recent thread where I use a method to do this with a repeater and comma-delimited values. The basic formulas are at the bottom of the post.
Also, consider if you could use a simpler method of testing your global variable for the presence of a value without anything too fancy. Your condition would simply test If OnLoadVariable contains "TargetValue" and then you wouldn’t have to worry about any string functions. Of course, your values would have to be fully unique, so you couldn’t have “1” and “12” and test if it contains “1”. Rather, you’d need your values to be something like “001” and “012”.