Board Thread:Support Requests - Getting Technical/@comment-45606548-20200906151533/@comment-9605025-20200907022801

HumansCanWinElves, you are correct. The purpose of having the 2nd #explode function is to check to make sure there is nothing in the list after the whitespace string. If you assume that the input it properly formatted, then you can indeed simplify the loop. However, I personally prefer to idiot-proof my templates when it is reasonable to do so.

By limiting the #explode split to 2, you separate the input into the first item and the rest of the string. The delimiter between the first item and the rest of the string disappears but the others are left intact. Therefore, if the rest of the list has at least 2 entries (even if they are whitespace/empty strings), the 2nd #explode will return (at least) 1 instance of the delimiter (possibly surrounded by whitespace). The presence of the delimiter would make the while condition true and force it to continue through the list even if the current item is just whitespace (or an empty string).