Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: Update Array by explode()

  1. #1
    Junior Member
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Update Array by explode()

    I have and Array in html

    var Song_list = new Array("Symphony No.1", "Symphony No.2");


    Now I want update the Song_list by the content of Song.txt file

    Song.txt as below
    Symphony No.1
    Symphony No.2
    Symphony No.3
    Symphony No.4
    Symphony No.5

    I use explode() as the follows:

    <?php
    $f = fopen("Song.txt", "r");
    while (!feof($f)) {
    $arrSong = explode("\n",fgets($f));
    }
    fclose($f);
    ?>

    Now I have an array in php and need java code to use this php array to update Song_list = new Array("Symphony No.1", "("Symphony No.1", "Symphony No.2", "Symphony No.3", "Symphony No.4", "Symphony No.5");
    (java code to convert php array to javascript array)

    Or if do not use php function explode, what jave code to import song.txt to updated array Song_list?

    Thanks
    Last edited by docco; August 11th, 2012 at 01:19 PM.


  2. #2
    Junior Member
    Join Date
    Aug 2012
    Posts
    13
    Thanks
    0
    Thanked 7 Times in 4 Posts

    Default Re: Update Array by explode()

    You may get help if you find some html boards. Correct me if I am wrong, these boards directly concern the programming language Java.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Update Array by explode()

    java != javascript. Thread moved to other programming languages.

  4. #4
    Junior Member
    Join Date
    Jan 2013
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Update Array by explode()

    hey .. You should post this thread to some html or javascript thread forums ... because javascript is not equal to java and here java discusses in forums instead of java scripts..
    Have a wonderful day!

  5. #5
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Update Array by explode()

    Quote Originally Posted by jason003 View Post
    hey .. You should post this thread to some html or javascript thread forums ... because javascript is not equal to java and here java discusses in forums instead of java scripts..
    I suspect the user got this impressions almost 6 months ago when the first posted (and last visited). Please be cognizant of the posted dates of threads before replying to long dead threads

Similar Threads

  1. update .jar file?
    By denti in forum Java Theory & Questions
    Replies: 7
    Last Post: June 28th, 2012, 10:07 AM
  2. [SOLVED] JtextArea update issue.
    By Rihx in forum AWT / Java Swing
    Replies: 3
    Last Post: May 2nd, 2012, 11:46 AM
  3. update database from List<>
    By beruska in forum JDBC & Databases
    Replies: 3
    Last Post: November 7th, 2011, 03:21 PM
  4. Why my update.jsp is not working?
    By tangara in forum JavaServer Pages: JSP & JSTL
    Replies: 4
    Last Post: September 8th, 2011, 01:14 AM