A general technique for managing strings in comparison-driven data structures