Not it T-SQL, though I believe that one is available in SSIS.
I found this code:RTRIM(LTRIM(@matchText)) Is there no TRIM function?