when string length is 0, return 0, not 1