OK so I thought about it more and had some more time to come up with a better more adaptable solution. Scrap the first one as it requires you to know your data. The new idea doesnt require you to know your data and only requires that it is a string.
This ought to do it for you, hope it solves your problem.
-Dave