how to compare the string which is passed as a parameter
the following method is not working.
String str = \"saveMe\"
compareString(str)
def
If you don't want to check on upper or lowercases you can use the following method.
String str = "India"
compareString(str)
def compareString(String str){
def str2 = "india"
if( str2.toUpperCase() == str.toUpperCase() ) {
println "same"
}else{
println "not same"
}
}
So now if you change str to "iNdIa" it'll still work, so you lower the chance that you make a typo.