D
Daniel
HI!
I have an appliation that will need to parse a text of unkown length.
I get the data as an array of strings (and thus I know then how much
data it is)
I want to do several things on each "row" (that is each element in the
array) I want to
1. look for a specific word (start) and count how many of them there
are in total.
2. Highlight the word alarm and append a short description to the end
of the line
my first thought was to use
for(int i=0;i<data.length++){
if(data.endsWith("start"){
// do the work..
}else if(data.startsWith("Alarm")){
//do different work
}
}
this seems to be rather inefficent as I get two (and possibly more, my
employer did not seem think these few features were enough..)
Is there a better way to do this.
As the alarm line also contains an alarm code, I do not know what it
looks like. Any suggestions?
regards
/daniel
I have an appliation that will need to parse a text of unkown length.
I get the data as an array of strings (and thus I know then how much
data it is)
I want to do several things on each "row" (that is each element in the
array) I want to
1. look for a specific word (start) and count how many of them there
are in total.
2. Highlight the word alarm and append a short description to the end
of the line
my first thought was to use
for(int i=0;i<data.length++){
if(data.endsWith("start"){
// do the work..
}else if(data.startsWith("Alarm")){
//do different work
}
}
this seems to be rather inefficent as I get two (and possibly more, my
employer did not seem think these few features were enough..)
Is there a better way to do this.
As the alarm line also contains an alarm code, I do not know what it
looks like. Any suggestions?
regards
/daniel