string trimming and chopping functions, tests, doc fixes