Added more unit tests for the String utility class

When creating unit tests, I came across some edge cases which failed,
and based on this improved the String utility class to support these
edge cases.