Does anyone have a JAVA script that will search for a string within a
string within a text file or HTML file?
Something that simulates this Basic language command:
INSTR (position, string1$,string2$)
if position>0 then string found
Also, does anyone have a JAVA script file that will printout a
modified file based on the string found within a string.
----------------------------------------------
Thank you.
Hal Rosser - 01 Feb 2006 05:10 GMT
> Does anyone have a JAVA script that will search for a string within a
> string within a text file or HTML file?
[quoted text clipped - 4 lines]
>
> if position>0 then string found
Try the indexOf method of the string.
Assume strHaystack is the string you're searching and strNeedle is the
string you're searching for:
if (strHaystack.indexOf(strNeedle) >= 0){
//code if the string was found.
}
Hal Rosser - 01 Feb 2006 05:15 GMT
> > Does anyone have a JAVA script that will search for a string within a
> > string within a text file or HTML file?
[quoted text clipped - 11 lines]
> //code if the string was found.
> }
I think it will also work in javascript - what a co-inky-dink
Roedy Green - 01 Feb 2006 10:46 GMT
> Also, does anyone have a JAVA script file that will printout a
>modified file based on the string found within a string.
see http://mindprod.com/jgloss/javascript.html

Signature
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.