Completed trim() interface and its tests