简体   繁体   中英

String comparison

For my project, ppl can give an answer to a certain question they get. I perform userAnswer = etUserAnswer.getText().toString().toLowerCase(); on it and then compare it to a value that is stored in the SQL database.

But I was thinking that it is quite annoying for a user if the answer is just almost correct but if he has written 'kk' in a word instead of 'ck'. Therefor I am trying to create a system which checks if the answer is more or less correct and then returns the result of this. I searched the net but don't seem to find anything on this subject. I also don't know if such a system has a certain name in english?

Or.. maybe somebody knows a good tutorial or a good way to get started?

I guess you're looking for the string distance, for which you could eg use the Levenshtein Distance . For alternative metrics, see this question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM