Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    splitting text file into strings and then entering into array

    Hi,

    Im fairly new to javascript etc so please be patient!

    Im have a text file which I need to split into strings, and then enter these strings into an arrray.

    Thus, I have something like this:

    1 hello
    2 how are you
    3 goodbye

    I want to split this into strings (with each line being a new string) and turn this into the following:

    a[0] = 'hello'
    a[1] = 'how are you'
    a[2] = 'goodbye'

    Once in the array, the numbers in the original text become unimportant.

    Now I know that this can be achieved with an arraylist and possibly a scanner(?). But I dont know the syntax to implement these constructs.

    Any help would be much appreciated!

    Thanks!

  • #2
    New to the CF scene
    Join Date
    Dec 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for that, it's really useful!

    How would I implement this in PHP?

    Best

    Andy.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •