Fix hyphenated ID decoding

This pull request adds tests for `DecodeString()` and fixes hyphenated ID decoding to avoid an index out-of-bounds panic.

@jrconlin r?
Why isn't this an if/else?