while writing my program I have run into another nooby road block.
if(StringTerm[0].equals("wikipedia"))
{
StringBuilder SearchTermBuilder = new StringBuilder();
for(int i = 1; i < StringTerm.length; i++)
{
SearchTermBuilder.append(StringTerm[i] + " ");
}
// This is the string it outputs.
WIKI_ID = "Wikipedia";
SearchTerm = SearchTermBuilder.toString();
SearchTermFull = WikiBaseLinkReference.WIKI_WIK + SearchTermBuilder.toString();
}
This code checks for input from a console command "/wiki" and checks to see if the first string after the word "wiki" matches "wikipedia" and if so, it builds a string to match what I want it to do.
This is all well and good, and the program works fine, but I want users to be able to use different keywords to get the same results.
For Example: If I type /wiki wikipedia, it would do the same as /wiki pediawiki
If I made an array of different names called WIKIPEDIA
public static String WIKIPEDIA[] = {"wikipedia","pediawiki"};
How would I tell the if statement to check to see if the text entered equals one of the strings inside of my array? Every time I try to use an || or operator it throws me some errors.
Thanks in advance.