in reply to substr and strings on the outside

I'm not sure I fully understand what you are trying to do.. but maybe sprintf might help you.
-Syn0