Last active
October 21, 2015 09:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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