Thanks Jesse.

For the benefit of others I've tried the following:

node {  
    fn1("This should only be one string")
    fn1("Two", "Strings")
    fn2(["is", "This", "Three?"])
    fn3(["What", "about", "this?"] as String[])
    fn4(["Or", "perhaps", "this?"])
}

def fn1 (String... strs) {
    echo "${strs.size()}"
    def String s = ""
    for (int i = 0; i < strs.size(); i++) {
        s += "${strs[i]} "
    }
    echo "$s"
}

def fn2 (strs) {
    echo "${strs.size()}"
    def String s = ""
    for (int i = 0; i < strs.size(); i++) {
        s += "${strs[i]} "
    }
    echo "$s"
}

def fn3 (String[] strs) {
    echo "${strs.size()}"
    def String s = ""
    for (int i = 0; i < strs.size(); i++) {
        s += "${strs[i]} "
    }
    echo "$s"
}

def fn4 (List strs) {
    echo "${strs.size()}"
    def String s = ""
    for (int i = 0; i < strs.size(); i++) {
        s += "${strs[i]} "
    }
    echo "$s"
}

Here were the results:

Running: Allocate node : Start
Running on master in /nobackup/thdalton/jenkins/workspace/Sandbox
Running: Allocate node : Body : Start
Running: Print Message
30
Running: Print Message
T h i s   s h o u l d   o n l y   b e   o n e   s t r i n g 
Running: Print Message
3
Running: Print Message
T w o 
Running: Print Message
3
Running: Print Message
is This Three? 
Running: Print Message
4
Running: Print Message
W h a t 
Running: Print Message
3
Running: Print Message
Or perhaps this? 
Running: Allocate node : Body : End
Running: Allocate node : End
Running: End of Workflow
Finished: SUCCESS

I think I prefer the explicit List in fn4() so I shall go with that thanks.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

--
You received this message because you are subscribed to the Google Groups "Jenkins Issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to