-2

I have a string output like,

output=  [http://my1/new/Info_one, http://my1/new/Info_two, http://my1/new/Info_three]

I need to take only [Info_one,Info_two,Info_three]. I tried using,

    -----
    -----
    System.out.println("output="+output);  // above result
    String[] output2= output.split(",");   
    System.out.println("output2="+output2);  // result is like----->[Ljava.lang.String;@7013d1
    String[] output3= output2.split("/")   //gave error----->Cannot invoke split(String) on the array type String[]

How I can take only last part of this outputs?

Leel
  • 71
  • 8
  • 2
    Possible duplicate of [String delimiter in string.split method](http://stackoverflow.com/questions/7021074/string-delimiter-in-string-split-method) – Prasad Mar 02 '16 at 04:20

1 Answers1

1

As you have to split on each String in the array try

System.out.println("output="+output);  
String[] output2= output.split(",");   

for (String member : output2) {
    String[] output3= member.split("/");

    for (String str : output3) {
      System.out.println (str);
    }

    // or just the last one

    System.out.println (output3[output3.length - 1]);
}
Scary Wombat
  • 44,617
  • 6
  • 35
  • 64