Convert some string operations to (rather wordy) functors

Cue some optimisation of the functors before anyone sees this mess...