Please forgive me for the simplicity of the code that follows. I've been
coding java for about 3 weeks now... experienced with many other
languages but never had the oppertunity till now.
I'm struggling with the usage of the substring() function. I'm sure it
is just that I'm not stating the syntax correctly but I can't seem to
find what I'm looking for. Basically, I want to interrogate a string of
text that is read in from an input file, and depending on what is
contained in the string write an equal LISP statement. Should
be simple right???? Yeah... that's what I thought too.
Here's where I'm at now...
As soon as it hits the substring() statement I get an out of bounds error.
I want to say, "... look in positions 1-4 and if //// is present, read the next
line..."
Any help would be greatly appreciated.
Thanks,
Rita.
try {
in = new BufferedReader(new FileReader(inFileName));
out = new BufferedWriter(new FileWriter(clFileName,true));
// write header information
clLine = "# script to convrert control file to cl code";
out.write(clLine);
outLineNum = outLineNum + 1;
while(in.readLine() != null){
read = in.readLine();
linenum = linenum + 1;
// skip over comments and blank lines
if (read.substring(1,4)== "////") {
clLine = "";
}
else {
if (read.substring(1)== " ") {
clLine = "";
};
:
:
:

New Topic/Question
Reply




MultiQuote









|