I am trying to get the strings from arrays to match, however, they only match when the length of the string is equal. I use split to make the string to an array.
For example, taking the string "The Quick Brown Fox" from the database will match a user input of "The Quick Brown Fox" but not "The Quick Brown Fox Jumps"
I want to match the string "The Quick Brown Fox" with "The Quick Brown Fox Jumps" and count the 4 words (The Quick Brown Fox) as correct and the "Jumps" as a wrong. Also, I need to match the EnteredWordsSplit if it is shorter than the WordsFromDatabaseSplit string.
if (WordsFromDatabaseSplit.Length == EnteredWordsSplit.Length)
{
for (int i = 0; i < WordsFromDatabaseSplit.Length; i++)
{
if (WordsFromDatabaseSplit[i] == EnteredWordsSplit[i])
{
correct++;
}
else
{
wrong++;
}
}
textBoxEnter.Text = "";
}
else
{
//code for matching
textBoxEnter.Text = "";
}