The code it generates looks really smart, but my main concern is if you can accidentally trick it into going out of bounds in the array somehow and throwing an exception.
I like it. If you need more logic (eg only accept letters and numbers) then a regex would be better suited than a split. But the split and switch is nice and readable.