Reputation: 11
I have an XQuery variable, $RequestinteractionIds
, with a value like '47575','65656',
I would like to get rid of the last comma.
Please suggest a solution using XQuery (I am using Oracle's XQuery OSB).
Upvotes: 0
Views: 2082
Reputation: 20414
Good old substring should work too:
let $RequestinteractionIds := "'47575','65656',"
return substring($RequestinteractionIds, 1, string-length($RequestinteractionIds) - 1)
HTH!
Upvotes: 3
Reputation: 3517
A simpler regular expression for replace()
that would do the job would be:
replace("'47575','65656',", "(.*),$", "$1")
However, not everyone likes regular expressions or understands them, so you may find it more understandable to use tokenize
and then string-join
:
string-join(tokenize("'47575','65656',", ","), ",")
Upvotes: 3