niharika
niharika

Reputation: 91

Remove double quotes from a string in velocity template

The input is : var={cost=7022.61, marker=down, month=AUGUST, totalCost=17147.52}

The code is:

<table>
    <tr>
        <td>ESTIMATE FOR $var.month $var.cost</td>
    </tr>
    <tr>
        <td>Spent Last Month $var.totalCost</td>
    </tr>
</table>

output : ESTIMATE FOR "AUGUST" "7022.61"
Spent Last Month "17147.52"

Expected output : ESTIMATE FOR AUGUST 7022.61
Spent Last Month 17147.52

Upvotes: 3

Views: 3950

Answers (1)

Xstian
Xstian

Reputation: 8272

I had the same problem.

i solved in this way (velocity 1.7)

<table>
    <tr>
        <td>ESTIMATE FOR $!{var.month.replace('"',"")} $!{var.cost.replace('"',"")}</td>
    </tr>
    <tr>
        <td>Spent Last Month $!{var.totalCost.replace('"',"")}</td>
    </tr>
</table>

I hope I've given you all the answers about your question.

Upvotes: 4

Related Questions