Just started to learn Java. Help me to understand. Created a primitive code that takes a string from the user, puts it into an array and divides it into words. How now any word from this array to check whether it is in a specific text file? Enough simple design, just to understand the principle. If the word was found "Hooray, found," if not, "The word was not found." Thank.
import javax.faces.bean.ManagedBean; import javax.faces.bean.SessionScoped; import java.io.Serializable; @ManagedBean(name="user") @SessionScoped public class UserTextBean implements Serializable { public String txt; public String txtend; public String getTxtend() { txtend = txt.substring(0, 30); String[] output = txtend.split(" "); return output[1]; } public void setTxtend(String txtend) { this.txtend = txtend; } public String getTxt() { return txt; } public void setTxt(String txt){ this.txt = txt; } }
String, then useString.substring(...). - post_zeew