Hi,
Thank you for the reply..I modified the processTest function to the following. I found an article on how to do replacements using REGEX, but not when the INPUT is a file, that is what is really confusing me..
Below is the modified function:
And, this is the error that I am getting when running the file.
C:\cis3020\temp>
java Homework -5 tester.java
Exception in
thread "main" java.lang.StringIndexOutOfBoundsException:
String ind
ex out of range: -1
at java.lang.String.substring(Unknown Source)
at java.lang.String.subSequence(Unknown Source)
at java.util.regex.Matcher.getSubSequence(Unknown Source)
at java.util.regex.Matcher.appendReplacement(Unknown Source)
at Homework.processTest(Homework.java:90)
at Homework.main(Homework.java:52)
Also, I am not sure how to write the modified line back to the file. We are suppose to have a renameTo function which saves the inFile as a temp file, and then when the changes are made, it renames it back to the same as the input file...Would that have to be done first?
Thanks again