Add truncate & truncateFromCenter with test

This should be better right now :smile: 
And I would use "foo" and its various variants as the test string just like below for consistency.