Add a customized 'trim' function.