Abstracts string munging into setString function #1722