Looking for a more efficient way to replace leading and trailing empty spaces (\' \') and appending an \'X\' to the front. It seems to work ok for
\' \'
\'X\'