Just to add a little bit more explanation. The JavaScript implementation in the current Acrobat is based on ECMAScript 3 (or, better, the Mozilla JavaScript version 1.7 or 1.8).
The trim() method is new in ECMAScript 5, and therefore not supported.
It may become supported when/if Acrobat gets an upgrade of the JavaScript version to ECMAScript 5.
Hope this can help.
Max Wyss.