Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range

Also add tests for it

Change-Id: I713626bd778f45b5f7bfb6ca4ba2057f84c0a0c5
Merge "Fix a bug where trimOuterSpaceFromRange() didn't trim an all-whitespace range"