Search:

Type: Posts; User: Norm

Search: Search took 0.17 seconds.

  1. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Is your problem solved now?
  2. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    I copied the contents of the oq.txt file that was posted and saved it on my PC.
    When I run the posted code I get this in the testFile1.txt:
    There is a space before the ID=
    Also Notice there is NOT...
  3. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Please copy what is printed on the console and paste it here.

    Why is createNewFile being called inside of the loop?

    Is there other code that reads/writes the output file? I don't see any...
  4. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Why is createNewFile being called inside of the loop? Why is it trying to create the input file?
    What is in oq.txt when the program finishes?

    What is shown on the console when the program is...
  5. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Please post the current version of the code.
  6. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    The code has a list of if statements. Do you ever expect more than one of them to be true at the same time?
    If you expect only one if statement to be true, then you should this technique: if/else...
  7. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    You are making good progress. You should be able to do it yourself.
    Create a File for the output file
    Create a PrintWriter using that File object in its constructor.
    use the PrintWriter class's...
  8. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Is the code now updating lines as desired?
    One way to update the file is to copy and edit all the lines into a List, then write the contents of the List to the file.
    It is not possible to update...
  9. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Use an id statement:

    if(tested condition) {
    // do something if condition true
    }else {
    // do this if false
    }


    Use the + concatenation operator to concatenate one String to another:
  10. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    You need to print out the value in myStr so you can see if the results of the test are correct.
  11. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Ok, one step at a time:

    Look at the String class's methods.
    Find the method that looks at the starting characters in the String.

    Here is a link to the API doc for the Java SE 8 classes:...
  12. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Ok then the program works so far.
    Next these steps:

    Look at the String class for methods to do those steps to the String read by the nextLine method.
    To remove the ending character of a line use...
  13. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    What happened when you compiled and executed the program?
  14. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Ok, work on those steps first.
    Define a File class object with the path to the text file.
    Define a Scanner class object that receives that File class object in its constructor.

    For a test:
    ...
  15. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    Can you describe the steps to take without considering any specific programming language?
    What if the lines in the file were pieces of paper with words written on them and you had a pair of...
  16. Replies
    32
    Views
    1,891

    [SOLVED] Re: open text file and edit any line start with name

    What have you tried?
    What are the steps the program needs to take to provide the desired solution?
Results 1 to 16 of 16