SpunkyLoveMuff's method may work in some cases, but there is an easier and sometimes better way to do it.
code:
// In this example, the variable sFile contains all the text from the file you read.
var sSearch = "Is this in the file?"; // The variable contains what you are searching for.
var nIndex = sFile.indexOf(sSearch); // Find the index that this phrase is located.
if(nIndex > -1){ // String.indexOf returns -1 if the string is not found
// nIndex is the position (an integer) that represents where the first character is. It is zero-based.
var nEndIndex = nIndex + sSearch.length - 1; // The variable nEndIndex represents the index that the phrase ends on.
// Do whatever you want
} else { // If the index is -1, the phrase not found
// Do whatever
}
Also, Huhu_Manix's code will not give you what you want. His code will give you "bc", it cuts off the first letter. If you want the second, third, and fourth letter of a string, use this:
code:
var sString = "hello"; // The string to extract from.
var sSubString = sString.substr(1,3); // The first parameter is the index to start at. It is zero-based. The second is how many characters to include. If you leave out the second, it will just cut off however many characters you specify in the first parameter.