rtrim is faster than substr to remove last char