length of the string can be calculated in place