Format mode string.