Add function to get string length.