Reputation: 88
I want to split a string with ',' operator. The original string look like following
input : decode(test,0,nvl(test,0),1)
My expected output:
decode(test
0
nvl(test,0)
1
I tried following program
String input = "decode(test,0,nvl(test,0),1)";
String[] arr = input.split(",");
Help me to solve above issue
Upvotes: 2
Views: 102
Reputation: 44834
try this
String arr[ ]= "decode(test,0,nvl(test,0),1)".split ("nvl\\(test,0\\)");
result
arr[0] == "decode(test,0,"
arr[1] == "nvl(test,0)"
arr[2] == ,1
now split arr[0]
and arr[2]
using split(",");
Upvotes: 3