Search:

Type: Posts; User: copeg

Search: Search took 0.18 seconds.

  1. Replies
    10
    Views
    1,923

    Re: String[] to String

    There shouldn't be a need to read the file twice.

    Append a new line


    while ( //reading ){
    text.append(in.readLine());
    text.append("\n");
    }
  2. Replies
    10
    Views
    1,923

    Re: String[] to String

    You may have to post more code...where does the variable num come from? If you've read the file already then readLine returns null (and this nulls are appended to the StringBuffer)
  3. Replies
    10
    Views
    1,923

    Re: String[] to String

    Use a StringBuilder or StringBuffer, appending the lines as you loop through the array (or read the file). Then just convert to a string


    StringBuffer sb = new StringBuffer();
    String[] lines =...
Results 1 to 3 of 3