String: refactored ConvertToS() into template function toS().
String: added more test cases.