My string variable contains a String, each on a different line. How do I find the number of new lines in it, and then each word separated by a , delimiter on a particular string line? The variable content is something like below
null37,Abhishek,ARS,b,ABC,Development,2011-05-30 00:00:00.0,abhishek123@cjb.net
null38,Abhishek,SAS,c,ABC,Development,2011-05-30 00:00:00.0,abhishek123@cjb.net
null39,Abhishek,DGV,a,ABC,Production,2011-05-30 00:00:00.0,abhishek123@cjb.net
Edited:
I tried this
String xmlstr="""null37,Abhishek,ARS,b,ABC,Development,2011-05-30 00:00:00.0,abhishek123@cjb.net
null38,Abhishek,SAS,c,ABC,Development,2011-05-30 00:00:00.0,abhishek123@cjb.net
null39,Abhishek,DGV,a,ABC,Production,2011-05-30 00:00:00.0,abhishek123@cjb.net"""
String[] splitStr = xmlstr.split('\n');
for(String str : splitStr)
{
String splitted = str.split(',');
println splitted
}
I am getting something unknown,
[Ljava.lang.String;@148bd3
[Ljava.lang.String;@a4e743
[Ljava.lang.String;@4aeb52
To get the number of newlines do
To get each word separated by a comma do