I have to match two responses. One gives response say A like 113.00 and the other say B as 113 . I want to remove the trailing zeroes from A. How do I do it
I am reading the field value of A as below
def gainLoss =slurpRest.getRealizedByAccountResponse.securityList.e[b].GainLossList.RealizedGainLoss.text()
I tried using the below but get an error
def gainlossbig = new BigDecimal(gainLoss).setScale(0)
but get the error as 'Error in assertion script :null'
Please tell how do I remove the trailing zeroes in this case?
Instead you can coierce it to same data type.For instance: You may variable instead of static value below as well
//Below shows the example of coiercing to a specific type
def actualAmount = 113.00 as Double
def expectedAmount = 113 as Double
assert actualAmount == expectedAmount
Doesnt work. Get an error "Cannot cast object with class 'Java.lang.string' to class 'double'
Sorry . I did not get you. What data do you need? The Response ?