Skip to content

Instantly share code, notes, and snippets.

@istairbn
Last active October 21, 2015 09:40
Show Gist options
  • Save istairbn/28154705278f1f602c04 to your computer and use it in GitHub Desktop.
Save istairbn/28154705278f1f602c04 to your computer and use it in GitHub Desktop.
Takes two strings, strips punctuation and to lower case, then checks to see if the underlying content is the same
String firstInput = args[0]
String cleanedComparison = args[1]
def StringCleaner(String input,String comparison){
input = input.toLowerCase().replaceAll("[^a-zA-Z ]", "").replaceAll("\\s","")
comparer = comparison.toLowerCase().replaceAll("[^a-zA-Z ]", "").replaceAll("\\s","")
def finder = (comparer =~ input)
assert finder
println finder
}
println "Comparing Strings"
StringCleaner(firstInput,cleanedComparison)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment