Added an "intelligent" string length function.

To account for differences between environments.