File to array

Hi,
How do I use spreadsheet string to array function if my input file contains
@0000  0x11 0x22 0x00 0x00 0x00 0x00 0x00 0x00
@0008  0x06 0x55 0x6F 0x00 0x41 0x45 0x35 0x54
@0010  0x6F 0x00 0x41 0x45 0x35 0x54 0x2D 0x31
and I want my output in an array like this..
array[0]=0x11
array[1]=0x22
array[2]=0x00
array[8]=0x06
array[9]=0x55
and so on.
Message Edited by test_man on 06-21-2008 01:48 AM
Thanks.
CVI 2010
LabVIEW 2011 SP1
Vision Builder AI 2011 SP1
Solved!
Go to Solution.

Try e.g. the following (LV 8.0):
Message Edited by altenbach on 06-21-2008 01:28 AM
LabVIEW Champion . Do more with less code and in less time .

Similar Messages

  • Getting data from file to array

    try
        System.out.println("Enter file name: ");
        fileName = Object.nextLine();
        BufferedReader inputStream =
                new BufferedReader(new FileReader(fileName));
        String employee = null;
        employee = inputStream.readLine();
        System.out.println("The first employee in " + fileName + " is");
        System.out.println(employee);
        inputStream.close();
    catch(FileNotFoundException e)
        System.out.println("File " + fileName + " not found ");
    catch(IOException e)
        System.out.println("Error reading from file " + fileName);
    }This is just a little example I made. You can look at my other thread to see the other code. I need to put the data in a file into the array. Does it need to be casted somehow?

    public void getData()
           try {
       System.out.println("Enter file name to read: ");
       File = Object.nextLine();
       BufferedReader Object =
                new BufferedReader(new FileReader(File));
        for(int i = 0; i < people.length && people[i] != null; i++)
    String temp = Object.readLine();
    people.setLastname(temp);
    temp = Object.readLine();
    people[i].setFirstname(temp);
    temp = Object.readLine();
    people[i].setID(temp);
    temp = Object.readLine();
    people[i].setPhone(temp);
    temp = Object.readLine();
    people[i].setYearlySalary(Double.parseDouble(temp));
    temp = Object.readLine();
    people[i].calcBonus(Double.parseDouble(temp));
    temp = Object.readLine();
    people[i].getMonthlyPay(temp));
    } Object.close(); }I know, I got careless with the naming. I'm trying a different route now. I think I can just do it in reverse. lol How would I get the method getMonthlyPay to have no errors. It's a public void() method with monthlyPay = (yearlySalary + bonus) / 12; in its definition.
    anyone?
    Edited by: Program_1 on Dec 9, 2007 5:42 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Playing a wav file (byte array) using JMF

    Hi,
    I want to play a wav file in form of a byte array using JMF. I have 2 classes, MyDataSource and MyPullBufferStream. MyDataSource class is inherited from PullStreamDataSource, and MyPullBufferStream is derived from PullBufferStream. When I run the following piece of code, I got an error saying "EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x7c9108b2, pid=3800, tid=1111". Any idea what might be the problem? Thanks.
    File file = new File(filename);
    byte[] data = FileUtils.readFileToByteArray(file);
    MyDataSource ds = new MyDataSource(data);
    ds.connect();
    try
        player = Manager.createPlayer(ds);
    catch (NoPlayerException e)
        e.printStackTrace();
    if (player != null)
         this.filename = filename;
         JMFrame jmframe = new JMFrame(player, filename);
        desktop.add(jmframe);
    import java.io.IOException;
    import javax.media.Time;
    import javax.media.protocol.PullBufferDataSource;
    import javax.media.protocol.PullBufferStream;
    public class MyDataSource extends PullBufferDataSource
        protected Object[] controls = new Object[0];
        protected boolean started = false;
        protected String contentType = "raw";
        protected boolean connected = false;
        protected Time duration = DURATION_UNKNOWN;
        protected PullBufferStream[] streams = null;
        protected PullBufferStream stream = null;
        protected final byte[] data;
        public MyDataSource(final byte[] data)
            this.data = data;
        public String getContentType()
            if (!connected)
                System.err.println("Error: DataSource not connected");
                return null;
            return contentType;
        public void connect() throws IOException
            if (connected)
                return;
            stream = new MyPullBufferStream(data);
            streams = new MyPullBufferStream[1];
            streams[0] = this.stream;
            connected = true;
        public void disconnect()
            try
                if (started)
                    stop();
            catch (IOException e)
            connected = false;
        public void start() throws IOException
            // we need to throw error if connect() has not been called
            if (!connected)
                throw new java.lang.Error(
                        "DataSource must be connected before it can be started");
            if (started)
                return;
            started = true;
        public void stop() throws IOException
            if (!connected || !started)
                return;
            started = false;
        public Object[] getControls()
            return controls;
        public Object getControl(String controlType)
            try
                Class cls = Class.forName(controlType);
                Object cs[] = getControls();
                for (int i = 0; i < cs.length; i++)
                    if (cls.isInstance(cs))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Time getDuration()
    return duration;
    public PullBufferStream[] getStreams()
    if (streams == null)
    streams = new MyPullBufferStream[1];
    stream = streams[0] = new MyPullBufferStream(data);
    return streams;
    import java.io.ByteArrayInputStream;
    import java.io.IOException;
    import javax.media.Buffer;
    import javax.media.Control;
    import javax.media.Format;
    import javax.media.format.AudioFormat;
    import javax.media.protocol.ContentDescriptor;
    import javax.media.protocol.PullBufferStream;
    public class MyPullBufferStream implements PullBufferStream
    private static final int BLOCK_SIZE = 500;
    protected final ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW);
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM_MS, 8000.0, 8, 1,
    Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
    Format.byteArray);
    private int seqNo = 0;
    private final byte[] data;
    private final ByteArrayInputStream bais;
    protected Control[] controls = new Control[0];
    public MyPullBufferStream(final byte[] data)
    this.data = data;
    bais = new ByteArrayInputStream(data);
    public Format getFormat()
    return audioFormat;
    public void read(Buffer buffer) throws IOException
    synchronized (this)
    Object outdata = buffer.getData();
    if (outdata == null || !(outdata.getClass() == Format.byteArray)
    || ((byte[]) outdata).length < BLOCK_SIZE)
    outdata = new byte[BLOCK_SIZE];
    buffer.setData(outdata);
    byte[] data = (byte[])buffer.getData();
    int bytes = bais.read(data);
    buffer.setData(data);
    buffer.setFormat(audioFormat);
    buffer.setTimeStamp(System.currentTimeMillis());
    buffer.setSequenceNumber(seqNo);
    buffer.setLength(BLOCK_SIZE);
    buffer.setFlags(0);
    buffer.setHeader(null);
    seqNo++;
    public boolean willReadBlock()
    return bais.available() > 0;
    public boolean endOfStream()
    return willReadBlock();
    public ContentDescriptor getContentDescriptor()
    return cd;
    public long getContentLength()
    return (long)data.length;
    public Object getControl(String controlType)
    try
    Class cls = Class.forName(controlType);
    Object cs[] = getControls();
    for (int i = 0; i < cs.length; i++)
    if (cls.isInstance(cs[i]))
    return cs[i];
    return null;
    catch (Exception e)
    // no such controlType or such control
    return null;
    public Object[] getControls()
    return controls;

    Here's some additional information. After making the following changes to MyPullBufferStream class, I can play a wav file with gsm-ms encoding with one issue: the wav file is played many times faster.
    protected AudioFormat audioFormat = new AudioFormat(AudioFormat.GSM, 8000.0, 8, 1,
                Format.NOT_SPECIFIED, AudioFormat.SIGNED, 8, Format.NOT_SPECIFIED,
                Format.byteArray);
    // put the entire byte array into the buffer in one shot instead of
    // giving a portion of it multiple times
    public void read(Buffer buffer) throws IOException
            synchronized (this)
                Object outdata = buffer.getData();
                if (outdata == null || !(outdata.getClass() == Format.byteArray)
                        || ((byte[]) outdata).length < BLOCK_SIZE)
                    outdata = new byte[BLOCK_SIZE];
                    buffer.setData(outdata);
                buffer.setLength(this.data.length);
                buffer.setOffset(0);
                buffer.setFormat(audioFormat);
                buffer.setData(this.data);
                seqNo++;
        }

  • C++ tab delimited file to array

    Converting a large tcl project into c++ and i am struggling with the simplest tasks. For example, i used to create array of data from my file using the following method.
    .debug.t insert end "Reading Well Data\n" ; update
    set fileId [open data/$welldat r]
    set wcntr 0
    set welllist ""
    gets $fileId line
    while {[gets $fileId line] >=0} {
      scan $line "%s %s %f %f %f %f %f %f" wellid well xsurf ysurf xbh ybh elev td
      incr wcntr
      set wida($well) $wellid
      set wella($well) $well
      lappend welllist $well
      set xsurfa($well) $xsurf
      set ysurfa($well) $ysurf
      set xbha($well) $xbh
      set ybha($well) $ybh
      set eleva($well) $elev
      set tda($well) $td
    close $fileId
    Here is what i have so far in c++. Dont laugh i am using what is being taught at a community college class. Pretty basic stuff.
    #include <iostream>
    #include <fstream>
    #include <string>
    #include <sstream>
    using namespace std;
    int main()
            //Initialize temp Variable to hold lines and entrys.
            string fileLine = "";
            string tempEntry = "";
            //Initialize Arrays for wells.txt file
            string wellName [] = {""};
            long wellApi [] = {0}, tempAPI = 0;
            double surfaceX [] = {0.0}, surfaceY [] = {0.0}, bottomX [] = {0.0}, bottomY [] = {0.0}, kellyBushing [] = {0.0}, totalDepth [] = {0.0} ;
            //Create input file instance
            ifstream inWells;
            //open file
            //File format is a tab dilimited file
            //Well label, api, surface x coord, surface y coord, bottom x coord, bottom y coord, kelly bushing elevation, total depth of well
            inWells.open("wells.txt");
            //no else to check for failed open file.
            if(inWells.is_open())
                //intialize counter set to zero
                int fieldCounter = 0;
                //exits the loop when line is no longer good.
                //loop starts
                while (!inWells.eof())
                    //get the entire line and store it in a variable fileLine.
                    getline(inWells,tempEntry,'\t');
                    cout << fieldCounter << " " << tempEntry << endl;
                    fieldCounter ++;
            //end if
            system("pause");
    right now i was just trying to print each of my parsed entry's. Then i was going to add the data to the array's but for some reason when i print the data i donot get a counter on the 1st entry of each line.
    Example data
    THOMPSN_J__TERRILL_ST_272-#1    42389100990001    1015951.28    583865.59    1015951.30    583865.60    2681.00    21368.00
    PANTHER_EX_KIMBER_GAS_17-#1    42389303410000    962142.94    571723.08    962142.90    571723.10    2829.00    14640.00
    INDREX_INC_CONOCO_STA_20-#1    42389312220000    961498.99    566401.78    961499.00    566401.80    2841.00    14386.00
    NEWPORT_PE_ALAMO_GIN_14-#1    42389313420000    962094.09    575749.87    962094.10    575749.90    2814.00    15316.00
    SHELL_WEST_HOEFS_52-2_23-#1    42389326050000    1008181.09    548865.88    1008181.10    548865.90    2802.00    10900.00
    OXY_USA_WT_BUSH_13-25_253-#1    42389326170000    1003471.84    582962.26    1003471.80    582962.30    2708.00    12590.00
    OXY_USA_WT_HENDRICK_S_254-#1    42389326180000    1004569.07    586773.12    1004569.10    586773.10    2701.00    12795.00
    PRIMEXX_OP_PISTOLA_186-#1    42389326270000    986849.60    559777.62    986849.60    559777.60    2745.00    12600.00
    PRIMEXX_OP_BELL_213_213-#1    42389326350000    992022.77    558517.55    992022.80    558517.60    2760.00    12674.00
    PRIMEXX_OP_CAPPS_214__214-#1    42389326360000    990737.88    553380.84    990737.90    553380.80    2790.00    12084.00
    OXY_USA_WT_POLO_GROUN_150-#1    42389326430000    983009.38    566162.59    983009.40    566162.60    2744.00    13500.00
    OXY_USA_WT_EBBETS_14_149-#1    42389326560000    983502.05    568782.50    983502.10    568782.50    2727.00    12500.00

    On this or this or
    other similar sites you can find helping hands for your project.
    --pa

  • Using the jprogress bar for file byte array downloads

    I am currently using a byte array to send files back and forth between computers. To show a file is transferring i change the mouse to the hour glass but would like to use the jprogressbar.
    To send the file i read the file from one computer into a byte array, and then send it through an objectoutputstream. I am not sure how the file is sent or received though. What can i use to judge the length of time it takes to get one file from one computer to the other? In doing a debug, it looks like the oos sends the file to the other computer, and it is basically like an uploading process. is there a way for me to judge or tell how much of the file that is being uploaded is left?
    Thanks in advance

    If i know the file size how can i then check the progression? I would also like to use an progress bar on the upload of a file to the other computer, and for the download of the byte array to the other computer i could first give it the file size. if then what can i use to base my progression off of?
    i looked at this and it says i am not able to do it, but thought there might have been improvements in the jdk since then, and i might not be seeing them
    http://forum.java.sun.com/thread.jspa?threadID=357217&messageID=1490887
    Thanks

  • Read a text file into array

    Can anyone let me know how to get read the values column wise from the text file and put each column in each arrays.
    for eg: if we have 4 columns in the text file then the values will be stored in 4 arrays.
    Thanks in advance
    Regards
    Kutty

    Use a two dimensional array to store your data, and use the StringTokenizer class to split up the lines as you read them in from the file.

  • Help with reading in a text file and arrays

    I need to read in a text file with info like this for example
    dave
    martha
    dave
    billy
    I can read the information into an array and display the names but what I need to do is display how many times the same name is in the file for example the output should be
    dave 2
    martha 1
    billy 1
    How can I accomplish this? Would I use a Compareto Method to find
    duplicate names?

    Hi,
    I would recommend storing them in a Hashtable.. something like this:
    Hashtable names = new Hashtable() ;
    String s ;
    while( ( s = bufferedReader.readLine() ) != null ) {
        if ( names.contains( s ) ) {
           names.put( s , new Integer( names.get(s)+1 ) ) ;
        else {
           names.put( s , new Integer( 1 ) ) ;
    }Then the hashtable will contain a set of keys and values, which are the names and counts respectively.
    Kenny

  • Still having trouble with reading text file into array

    Hi, This is from another post, I have tried one of the solutions that were provided, but got the following error at runtime:
    C:\j24work>java Test7
    Exception in thread "main" java.lang.StringIndexOutOfBoundsException
    at java.lang.StringBuffer.deleteCharAt(StringBuffer.java:681)
    at Test7.main(Test7.java:26)
    My code is attached. My text file reads as follows:
    7 5.5 15 5.35 30 6.5
    The first , third and fifth numbers should ultimately be int values representing the term of a mortgage. The second, fourth and sixth numbers ultimately need to be doubles representing the rate on a mortgage. Do I need a 2d array??
    import java.io.*;
    import javax.swing.*;
    import java.awt.*;
    import java.text.*;
    public class Test7 {
        public static void main(String[] args) throws Exception {
            String line        = null;
            int count   = 0;
            StringBuffer Term  = new StringBuffer();
            StringBuffer Rate  = new StringBuffer();
            BufferedReader input = new BufferedReader (new FileReader ("MortgageValues.txt"));
            while ((line = input.readLine()) != null) {
                if(count%2 == 0) Term.append(line).append(",");
                else        Rate.append(line).append(",");
                count++;
            Term.deleteCharAt(Term.length() -1);
            Rate.deleteCharAt(Rate.length() -1);
            System.out.println("Term>>>" +Term);
            System.out.println("Rate>>>" +Rate);
           // input.close ();
        }

    Okay, modify the code as below:
    import java.io.*;
    import java.util.*;
    public class Test7 {
        public static void main(String[] args) throws Exception {
            String line             = null;
            StringTokenizer strTok  = null;
            int count          = 0;
            StringBuffer term  = new StringBuffer();
            StringBuffer rate  = new StringBuffer();
            BufferedReader input = new BufferedReader (new FileReader ("MortgageValues.txt"));
            while ((line = input.readLine()) != null) {
                strTok = new StringTokenizer(line);
                while(strTok.hasMoreTokens()) {
                    if(count%2 == 0)    term.append(strTok.nextToken()).append(",");
                    else                rate.append(strTok.nextToken()).append(",");
                    count++;
            term.deleteCharAt(term.length() -1);
            rate.deleteCharAt(rate.length() -1);
            System.out.println("term>>>" +term);
            System.out.println("rate>>>" +rate);
           input.close ();
    }Cheers!
    ***Annie***

  • I want to sample syncronously an analog and digital channel and write them to file in array.

    I have a PCI-MIO-16XE-10. I am using the AI01 and a DI01 to recieve the signals. I am monitoring and switch and want to know when it comes on in relation to my analog signals when I post process the data so it is important that the signals be synced and placed in the data array. The attatched vi gives some idea of what I want to do. Thank you in advance for help concerning this.
    JML
    Attachments:
    DigitalAnalogSample.vi ‏34 KB

    I am using 6221 same issue i have .
    i need to accuire pulse of train and its simaltanously triggering the AI.
    Issue is while writing this data to an Excel sheet i am missing some data in-between.
    number of pulses are 870 , this count i am getting incermentally in the output of Counter
    i did "build an array" with this AI and Counter data and writing it to file, there i misses data.
    Attached wiring diagram for reference.
    Pls suggest some method to write data to file for every pulses so that i wont miss any data.
    Joe
    Using Ver. 8.0
    Attachments:
    Wiring1.JPG ‏137 KB

  • Binary File to Array

    I need to choose a file with a file chooser and then convert it to an array.  The file is a binary file and I just want every byte out of it as an element in a very large byte array.  Im not quite sure how to go about this, can someone who has done this or knows how guide me in the right direction?
    When I run the enclosed vi it acts as if the file is not 512 bytes big and says that an EOF has been reached.  Im sure Im just doing it plain wrong tho .
    The zip contains two of the files I wish to read in as well as my poor attempt to read the file into a byte array. The vi has two main problems:
    1) It doesn't work
    2) It doesn't take into account variably sized files
    Thanks
    Cason Clagg
    SwRI
    LabView 7.1, Windows XP
    Attachments:
    FileOpen.zip ‏12 KB

    (1) You wire a byte stream type of I32, meaning you read 4x as many bytes as intended.
    --> solution: right click in the type constant and select Representation:U8.
    (2) You can get the actual file size e.g. with the eof function.
    See attached modification (LabVIEW7.1).
    ... and don't forget to close the file when done
    Message Edited by altenbach on 07-21-2005 06:16 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    OpenFileMOD.vi ‏24 KB

  • Tab Delimited data from file into array

    Could someone give me a full example of how to pull strings out of a text file and insert into an array. I have posted a couple of times and the segments of code that I get back isn't working. I don't know where I am going wrong exactly, so I would like to see a full example. Here is what I posted last.
    I don't want to use a loop. I want to specify what each array element is and how may there are before it is run.
    import java.util.StringTokenizer;
    import java.io.*;
    public class ReadDataFile
    public static void main(String args[])
    try
    FileReader fr = new FileReader("DataFile");
    BufferedReader br = new BufferedReader(fr);
    String s;
    String data[] = new String[12];
    int count = 0;
    while((s = br.readLine()) != null)
    StringTokenizer st =new StringTokenizer(s);
    data[0] = st.nextToken();
    data[1] = st.nextToken();
    data[2] = st.nextToken();
    data[3] = st.nextToken();
    data[4] = st.nextToken();
    data[5] = st.nextToken();
    data[6] = st.nextToken();
    data[7] = st.nextToken();
    data[8] = st.nextToken();
    data[9] = st.nextToken();
    data[10] = st.nextToken();
    data[11] = st.nextToken();
    data[12] = st.nextToken();
    System.out.println(data[3]);
    catch(IOException ioe)
    System.out.println(ioe.getMessage());
    With this I get this error when I try to run it.
    Exception in thread "main" java.util.NoSuchElementException
    at java.util.StringTokenizer.nextToken(StringTokenizer.java:235)
    at ReadDataFile.main(ReadADataFile.java:37)
    Thanks

    Just return String array instead of returning vector and change tokanizer according to ur requirement
    public Vector valuesarr(HttpServletRequest req, HttpServletResponse res,String user,String filename,String folder)
                        PrintWriter out =null;
                        boolean indbool=false;
                        boolean fd=false;
              try{
                             out = res.getWriter();
                        BufferedReader br =null;
                        String     fl=folder+"/txt/"+filename+".txt";
                        File tt = new File(fl);
                   String s, s2 = new String();
                        String userval;
                        String files;
                        int ind=0;
                        boolean indigo=true;
                        Vector v=new Vector();
                        if( tt.exists() )
                             String mainarr[]=null;
                             br = new BufferedReader(new FileReader(fl));
                                  while((s = br.readLine())!=null)
                                            s2=s+"\n";
                                            if (s.indexOf(user) > -1)
                                                 ind=s.indexOf(user);
                                                 StringTokenizer st = new StringTokenizer(s,";=");
                                                 String [] filearr1=new String[s.length()];
                                                 int t=0;
                                                      while(st.hasMoreTokens())
                                                           String stfiles1=st.nextToken();
                                                           filearr1[t]=stfiles1;
                                                           t++;
                                                 String filearr2 []=new String[t];
                                                      for( int a=0;a<t;a++)
                                                           if(filearr1[a]!=null)
                                                           v.addElement(filearr1[a]);          
         return v;
    }catch(FileNotFoundException f)
         out.println(f.getMessage());
         return null;
         catch(IOException io)
              out.println(io.getMessage());
              return null;

  • Large Binary file to array

    Hi,
    I'm relatively new to Labview and am having trouble with large arrays. I'm using Win32 IO functions to read a 8MB file into Labview and this products a large U8 array. I want to produce a binary array containing the second bit of each byte in this array. For example:
    File:00000000 00000010 00000000 00000010 00000010
    Binary array: 01011
    At the moment I'm using a For Loop and clearly its very inefficient. Is there any way to do the above in a relatively short period of time?
    I used a subvi containing a For Loop and enabled Reentrant execution but this isnt very fast either. 
    Any help would be greatly appreciated,
    John
    Attachments:
    image_bin.png ‏9 KB

    Hi John,
    You can use boolean operators on integers. No need to convert to boolean array. To extract a bit, just AND with a constant with the bit in question set. Also, you don't need the loop.
    See attached example.
    The quotient & remainder is one way to scale the resulting array to 1. Without this you'd get an array of 0's and 2's.
    Hope this helps,
    Daniel
    EDIT: Sorry for repeating 10degree, I was distracted while writing the message
    Message Edited by dan_u on 07-07-2009 03:52 PM

  • Help me about file and array

    hi
    I need read a file into an array and write a new file from that array.
    for example I read photo.gif into an array (array[ ]) and I write
    newphoto.gif from that array (array[ ] )

    Your read(cleartext) method may or may not read the whole of the file at one time. The value returned by the read is the number of bytes actually read and may not be all the bytes in the file. So the answer is that you can't reliably use your code though it may work most of the time.
    Did you read my comment about reading the whole of a file into memory at one time? Did you bother to look at the reference I posted?
    Message was edited by:
    sabre150

  • Parse Text-File into array

    Hi,
    I hava a text-file with a structure like this.
    "sfdgasdf" "sadsadsadf" "sadfsdfasfd"
    "qwevsdf" "sdgfasdfsafd" "yxvcyxvcyxvc"
    "hgfddfhhfdfdf" "ewrtqwrwqewqr" "dfgdgdgsdgsdfgsdgg"
    My aim is to read this text-file (*.txt) and parse it into an string-array (or whatever is the best). The contents between the apostrophes should be inserted in this array line by line.
    For example:
    array[0][0] = "sfdgasdf";
    array[0][1] = "sfdgasdf";
    array[0][1] = "sadfsdfasfd";
    array[1][1] = "qwevsdf";
    How can I achieve this?
    Thanks
    Jonny
    That's how far i came (not very far).
    File file = new File("c:\temp\text.txt");
    FileReader stream = new FileReader(file);

    Hi,
    still facing some problems.
    My text which I want to parse:
    "sfdgasdf" "sadsadsadf" "sadfsdfasfd"
    "qwevsdf" "sdgfasdfsafd" "yxvcyxvcyxvc"
    "hgfddfhhfdfdf" "ewrtqwrwqewqr" "dfgdgdgsdgsdfgsdgg"
    My code:
    String[] parse = text.split("\"");
    The array that is created has whitespaces and linebreaks as elements. I only want the characters in beween the apostrophes.
    How can I "tell" the split function not to insert them in my array?
    Cheers
    Jonny

  • Read xml file to array

    I would like to read an xml file to an array before placing it in a document. I have seen people on here do something similar but I just can't get it to work.
    Right now I am having to open the docuement as just a file read it into an array and then pull the elements I want with a regex expression, which is pretty tedious.
    It seems the framework has some pretty nice xml element functions if I could just read the file in an xml format
    Right now I am doing something like this to read the file
    myfile = new File (path to file);
    myfile.open("r");
    myothervariable = myfile.read();
    myfile.close();
    But I am just reading it as simple text. I can't use any of the xml properties or functions on any of this. Does this make sense?
    Thanks in advance for any help

    Do this:
    myfile = new File (path to file);
    myfile.open("r");
    myXML = new XML (myfile.read());
    myfile.close();
    You now have an XML object that you can parse with JavaScript. See the ESTK's JavaScript Tools Guide (in the ESTK's Help menu), the chapter entitled "Integrating XML into JavaScript" (ch. 9 in CS5).
    Peter

Maybe you are looking for

  • I updated iTunes and can no longer find my playlists

    I no longer have my playlists and more than half of my music is gone from my iTunes library?  Where did it go?

  • How can I find music folder in itune that I just transfered?

    I am Finding it hard when it comes to tranfering music from My Laptop to itune and from itune to iphone. here are my issue, please let me know what am I doing wrong. 1. Lets say I have 'A' folder that I want in my itune, I go to file and then select

  • Invalid/Failed SIM Error

    Since updating to IOS7.0.3 last night on my 5 I now get SIM Failed or Invalid Sim Error Message.  I shut it down,took out the card, toggle airplane mode and nothing seems to work.  Any ideas?

  • ADF messages in locale Catalan

    Jdev. 11.1.1.4 Does anyone know if ADF messages are also in "Catalan" language. It is an european local language. Or anyway to look for it..... I'm translating an application to his language and have found that some System messages appear in English

  • No 64 bit version of Photoshop CC

    When I download Photoshop CC (2014) from Creative Clouds it gives me the 32 bit version even though my os is 64 bit. I have used the old Ps CC 64 bit but I uninstalled when I was going to update.