Skip to main content

Spliting the String[] of array



how do i split the code into three items





reading the data and dumping into String of Array :







String[] songs_array = directory_listings.split(":::");







here is the restultset looks like:







:::Chapter 01>>>Name of the Book>>>Spanish name:::







and once its in songs_array variable i would like to do similar to like this: but the above code just return me a string :::Chapter 01>>>Name of the Book>>>Spanish name:::







m_orders = new ArrayList<Order>();



Order obj = new Order();

obj.ChapterNumber(songs_array[0]);

obj.EnglishName(songs_array[0][1]);

obj.SpanishName(songs_array[0][1][2]);

m_orders.add(obj);







any help?


Comments

  1. Something along these lines I would imagine.

    String[] songs_array = directory_listings.Split(":::");
    var m_orders = new List<Order>();

    for (int i = 0; i < songs_array.Length; i++)
    {
    var song = songs_array[i].Split(">>>");

    m_orders.Add(new Order()
    {
    ChapterNumber = song[0],
    EnglishName = song[1],
    SpanishName = song[2]
    });

    }

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?