Trim strings while extracting.

Fixes #1.