Extract seperate values from a comma seperated string

I’m trying to extract 2 values from a string so I can subtract one from the other, and postUpdate the result.
The String is taken from incoming JSON and after using “transform” I end up with
[[1038,1039]]
I can remove the square brackets by using

var String TransformString = (Incoming.replace('[[','').replace(']', ''))

which gives me 1038,1039
I’m unsure where to go from here to get the individual values to perform the subtraction with.

val numsStr = TransformString.split(",")
val int first = Interger::parseInt(numsStr.get(0))
val int second = Integer::parseInt(numsStr.get(1))
val int sub = first - second
2 Likes

Thanks Rik, works a charm!