Split not allowing optional parameters


As shown in image (hopefully), split isn’t accepting the third and fourth arguments. Have tinkered around with it for a bit, wondering what’s up and why it won’t work. I’d like to let it delete empty strings (“”). Thanks.

The optional arguments are keyword arguments.

split(
    "something},1",
    "}";
    limit=0,
    keepempty=true
)

In a single line, you could also write one of the following.

split("something},1", "}"; limit=0, keepempty=true)
split("something},1", "}", limit=0, keepempty=true)

All the arguments past the optional ; must be keyword arguments.

1 Like

PS. Please don’t post screenshots of code. Post quoted code as text: PSA: how to quote code with backticks

Also, if splitting on a single character, using a Char instead of a String (i.e. '}' instead of "}") for the splitter might improve the speed:

split("something},1", '}'; limit=0, keepempty=true)