B
booksnore
..eh I was stuck thinking up a subject title for this post for a while..
So I am processing a really big file (scary big). Each record is fixed
length, I need to test conditions on certain fields in the record. At
the moment the most efficient way I've found to process the data is a
series of nested if/else statements so like below. My question is does
anyone know of a better way to process this kind of logic. I can't use a
switch statement because each condition applies to a different field
(substring) of the input record.
if (condition1)
{
reject(line);
}
else
{
if (condition2)
{
reject(line);
}
else
{
process_record(line);
}
}
}
Any thoughts appreciated.
Joe
So I am processing a really big file (scary big). Each record is fixed
length, I need to test conditions on certain fields in the record. At
the moment the most efficient way I've found to process the data is a
series of nested if/else statements so like below. My question is does
anyone know of a better way to process this kind of logic. I can't use a
switch statement because each condition applies to a different field
(substring) of the input record.
if (condition1)
{
reject(line);
}
else
{
if (condition2)
{
reject(line);
}
else
{
process_record(line);
}
}
}
Any thoughts appreciated.
Joe