For example,we have a String name test as given below
def test = "HAVING first_name like "%Hello,Ram%" AND last_name like "%XYZ%",order by id asc,name desc"
So,after splitting i would like to have a result like
test1 = HAVING first_name like "%Hello,Ram%" AND last_name like "%XYZ%"
test2 = order by id asc,name desc
How to split such strings in grooyy? I tried splitting it by checking contains(",")
and using the split
function, but it would also split "%Hello,Ram%"
which is not the result required
def a = 'HAVING first_name like "%Hello,Ram%" AND last_name like "%XYZ%",order by id asc,name desc'
def v = a.contains(",")
if(v){
a.split(",")
println a
}