cpp: compat: Add string trimming utility functions
wip9
wip10