amw
amw

Reputation: 535

Groovy: Problem when writing string parameter to file

I've a jenkinsfile containing a string parameter:

 parameters {
    string (
        name: 'ParPattern',
        defaultValue: "{'XY1*'}"
    )
}

Later on, I'm writing this to a text file:

def Simulation(ParPattern) {
    writeFile (
        file: 'myfile.txt',
        text: """                    
                    FunctionCall(${ParPattern});
            """.stripIndent()
    )

When running the job with parameter value {'XY9?7','XY9?8','XY9?9','XY9?​0','XY9*0'} I expect to get a myFile.txt containing

FunctionCall({'XY9?7','XY9?8','XY9?9','XY9?​0','XY9*0'})

Instead I get

FunctionCall({'XY9?7','XY9?8','XY9?9','XY9??0','XY9*0'})

Why does the second question mark shows up in XY9?0?

Thanks

Upvotes: 0

Views: 415

Answers (1)

Altaf
Altaf

Reputation: 3086

This seems there was an extra . that came up when I copied the default values.

enter image description here

I removed the extra . and added in the default value, then it gave the value.

Upvotes: 1

Related Questions