implemented a string formatter

Ported from https://github.com/aldergren/pyfileseq