Use Joomla's string filter for trimming.