Added more comments and preconditions/postconditions to StringUtils.