Hi to All,
in order to manipulate the Value of the the custom fileds using Groovy script, I would need to use the following features (function) that they are present in Java :
*.toLowerCase()
Math.min()
*.replace()
.substring()
It would be possible?
Thanks 4 the answer.
Francesco
Hello,
Yes, it is possible. Groovy is based on Java that is why you can just use pure Java there. That would be a simple script which you can try in Script Console
def str = "String"log.error(str.toLowerCase())log.error(Math.min(2,1))log.error(str.replace("t", "r"))log.error(str.substring(1, 2));
Groovy is a JVM based scripting languages with it's own set of idiosyncracies , here's the code snippet with requested methods -
println 'ABCDEF'.length() // output: 6println 'ABCDEF'.substring(1) // output: BCDEFprintln 'ABCDEF'.indexOf('C') // output: 2println 'ABCDEF'.replace('CD', 'XX') // output: ABXXEFprintln 'ABCDEF'.toLowerCase()
Math class is available from the JVM itself at run-time thus groovy can use it as well. "Math.min (1,2)" will return smaller of the two numbers.
It looks like you're new here. Sign in or register to get started.