OK, it's all cosmetic from here. The prog works & functions very well. But... don't ya love it... I want to strip the double quotes from the fields when I read it in & then put them around it when I write it back out. I also need to strip/replace 2 bang signs (!!) at the front of 3 of the fields. I read the strings into the string lineOfInput. I then use string test = lineOfInput.replace('"',' '), it compiles, but I get a runtime error...
C:\Dev\JavaProjects\Editmsg>java FileEdit Exception in thread "main" java.lang.NullPointerException at FileEdit.main(FileEdit.java:333) 333 is the line of the replace. I just read the previous post on string replace & my syntax looks correct.
Earnest, thanks yet again. R U psychic, or WHAT? Without even seeing my code you knew I was using the != null test in my while loop. I think I'll need an additional book, the 2 I have are just not cutting it. Que's "JAVA Quick Reference", Michael Afergan, & the "Beginning Programming with Java for Dummies", Barry Burd, NEITHER tell me that the readline() returns a null at eof. Still, that's no excuse, I should have realized it by the test in the sample code. I'm going out this weekend & try something else. Thanks again. -Bill.
author and iconoclast
Oh Omnicient One... why does my output now have a 100 in front of it? I've taken your suggestion & the quotes & !! strip off easily. But when I try to put them back on, well... it's just what greenhorns do. I suspect the char can't be "tacked onto" a string, but String or Byte didn't improve things any either. Here's a piece of my mess...
Is there a better way to do the ??? line? concat?, etc. I read the post on strings, but it was a bit over my head just yet. Thanks, -Bill.
Exactly. The + operator only concats string; it adds everything else. Remember that a char is really a number behind the scenes. A Quote is ASCII 34 and a Bang is ASCII 33. When you say quote + bang + bang, you are really saying 33 + 33 + 34, which is 100. Then it adds the string (It converts the 100 to a string and then concats).
Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.