Is it possible to compare strings to arrays in android? This is for the dictionary application using the Porter Stemmer that i am developing for my thesis.
For example the input word is PROCESSES (placed inside a char array), and I'd like to scan if the input contains "s","es" or "sses" then delete them.
I thought of comparing letter by letter but it would be a tedious coding I believe. Is there an easier way to just compare the input word like so:
If ( inputWord has string "es" )
{
delete "es
}
example input: PROCESSES
example output: PROCESS
if(inputWord.contains(checkWord))
{
int i = inputWord.indexOf(checkWord);
StringBuilder sb = new StringBuilder(inputWord);
sb = sb.delete(i, i+(checkWord.length()));
inputWord = sb.toString();
}
Store your values in String. It will be more easier. Hope this code will help you. If you have to check multiple words, store all words in a array, and put this snippet inside a for loop.