from String in Array



  • There's a lot of text that's divided by a certain flow, so let's say:

    string = "Cat<tag>Dog<tag>Fox<tag>Snake";
    

    We need to get this:

    array = ['Cat', 'Dog', 'Fox', 'Snake'];
    

    To call:

    array[2] = 'Fox';
    

    On JavaScript + jquery, the code worked well:

    arr = string.split('<tag>');
    

    How do you get to work?

    String[] types = result.split("<br2>");
        for(int i = 0; i < types.length; i++){
            types[i] = types[i].split("<br1>");
        }
    }
    

    Type: types[i][0]



  • It's like,

    String string = "Cat<tag>Dog<tag>Fox<tag>Snake";
    String[] splitedString = string.split("<tag>");
    



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2