Hello. I am going to be reading from a .txt file line by line in which the lines will have "fill in the blanks" so to say. For example, one of the lines of text might read
both of you <verb> <adverb> to the left. Next, you and
In this case the line would be read, then it will prompt the user for a verb and then replace <verb> with the users input. It would then ask for an adverb and replace the <adverb> with the users next input and so on throughout the entire .txt file. Right now I have
if(line.toLowerCase().indexOf("plural-noun")!=-1)element="plural-noun";
else if(line.toLowerCase().indexOf("verb")!=-1)element="verb";
else if(line.toLowerCase().indexOf("adjective")!=-1)element="adjective";
else if(line.toLowerCase().indexOf("adverb")!=-1)element="adverb";
else if(line.toLowerCase().indexOf("noun")!=-1)element="noun";
else if(line.toLowerCase().indexOf("name")!=-1)element="name";
else if(line.toLowerCase().indexOf("noise")!=-1)element="noise";
else if(line.toLowerCase().indexOf("number")!=-1)element="number";
else if(line.toLowerCase().indexOf("place")!=-1)element="place";
else return;
System.out.print("Please type a "+element+": ");
String userInput=in.next();
line = line.toLowerCase().replace("<"+element+">",userInp ut);
Is there any way that I could just always get the word in between the brackets < >? Thanks!