Utilities for calculating statistics about strings