Good that you were able to find the answer. Keep in mind, though, that you’ll get an error if there is no dash in that value. If you can predict that there will always be a dash there, then you’re all set!
If you’re interested, here’s how that could be written in one line.