Hi @all
Want to split Names in a table to an output table:
i. e.
id Name
1 Tick
2 Trick
3 Tom (Jerry)
4 Goofy
5 Mickey (Mini)
and so on..
want to split to an output table with id, Name, Image
id Name Image
1 Tick Null
2 Trick Null
3 Tom Jerry
4 Goofy Null
5 Mickey Mini
i´ve got some problems within the code, i think it´s a problem because of the string split
String klammerAuf = "\\(";
String klammerZu = "\\)";
//String leerSchritt = " ";
String container;
container = "Null";
int k = input_row.Name.indexOf(klammerAuf);
int l = input_row.Name.indexOf(klammerZu);
//int m = input_row.Name.indexOf(leerSchritt);
if (k > 0 && l > 0)
{
System.out.println("l" + l);
System.out.println("k" + k);
output_row.Name = input_row.Name.split(klammerAuf); //or maybe split(klammerZu)
output_row.Name = input_row.Name.split(klammerAuf); //or maybe split(klammerZu)
}
if (k < 0 && l < 0)
{
output_row.Name = input_row.Name;
output_row.Image = container;
}
output_row.id = input_row.id;
--------------------------------
The above denoted code will output:
id Name Image
1 Tick Null
2 Trick Null
3 Tom (Jerry) Null
4 Goofy Null
5 Mickey (Mini) Null
..so... it doesn´t split...
why?? where am i wrong?? it doesn´t even print out l and k, so it already has trouble with the first if-loop. i switched the code countless times >> array out of bounds exception 1, or maybe i will get a problem regex pattern when i draw off the backslashes in klammerAuf and klammerZu
if i switch the code to String klammerAuf ="(Jerry)", just to see, what´s wrong (if i´ve some trouble with the brackets maybe), it looks like
id Name Image
1 Tick Null
2 Trick Null
3 Tom Null
4 Goofy Null
5 Mickey (Mini) Null
so then it already splits Tom (Jerry) but won´t show Jerry in the Image column.
thx for helping me.
nadine