I am new to groovy.I am reading values for 2 variables from console with below lines of code.
System.in.withReader {
println "Version: "
version = it.readLine()
println "Doc Type:"
Doc=it.readLine()
call getBillID(version,Doc)
}
getBillid method is as below,
def getBillID(int version,int doc)
{
allNodes.BillID.each {
theregularExpression=/\d+_\d+_\d+_\d_\d+_\d+_\d_${version}_${Doc}_\d+_\d+/
if(it != "" && it =~ theregularExpression) {
println "******" + it
}
}
}
now i want to use those variable values in my getBILLID method but i am getting error as
No signature of method: ReadXML.getBillID() is applicable for argument types: (java.lang.String, java.lang.String) values: [9, ]
where i went wrong.can any one tell me plz..
In addition to @Kalarani’s answer, you could also do this:
As an aside; I would be careful with your capitalisation and variable names, ie: you have a variable called
Docwith a capital letter. This is not the standard naming scheme, and you are best using all lowercase for variable names. You can see where it has got confused in thegetBillIDmethod. The parameter is calleddoc(all lowercase), but in the regular expression you reference${Doc}(uppercase again).This sort of thing is going to end up causing you a world of pain and bugs that might take you longer to find