0

I have a problem and I don't know if I can resolve it.

I have a field (from a table) that have a Carriage Return in his middle (it is a field called AddressComplete and it has the street and the city), I want to take the street when the city contains "London".

Does anybody know how can I split this field? The row separator is "\n" and the field separator is "\t" (I'm using Talend, with Java language)

3 Answers3

0

Do you mean something like that?

for (String[] line : field.split("\n")) {
    String[] info = line.split("\t");
    String street = info[0];
    String city = info[1];
}
0
  • You can provide newline regex or rely on the system property to get the system dependent newline character.
  • split function splits the string into tokens
  String.split(System.getProperty("line.separator"));
mtk
  • 13,221
  • 16
  • 72
  • 112
0

I imagine you want:

String[] tokens = field.split("\r");
Harry Jones
  • 336
  • 3
  • 8