how to find if groovy args contains a particular string
Posted
by groovynoob
on Stack Overflow
See other posts from Stack Overflow
or by groovynoob
Published on 2010-03-12T16:11:38Z
Indexed on
2010/03/12
16:17 UTC
Read the original article
Hit count: 201
groovy
println args
println args.size()
println args.each{arg-> println arg}
println args.class
if (args.contains("Hello"))
println "Found Hello"
when ran give following error:
[hello, somethingelse]
2
hello
somethingelse
[hello, somethingelse]
class [Ljava.lang.String;
Caught: groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.
String;.contains() is applicable for argument types: (java.lang.String) values:
[Hello]
why can I not do contains
?
© Stack Overflow or respective owner