Groovy adds the toSet() method to the String class in version 1.8. With this method we get a Set of unique String values from the original String value.
toSet()
String
String s = 'Groovy is gr8!' assert s.toSet().sort().join() == ' !8Ggiorsvy'