Trim spaces around search query

This commit is contained in:
Sad Ellie 2023-01-04 12:19:21 +04:00
parent 78f9d59fd8
commit 18231d0153

View File

@ -76,7 +76,7 @@ abstract class AbstractUnit(
* @return Sorted sequence of units. Units with lower Levenshtein distance are higher
*/
fun Sequence<AbstractUnit>.sortByLev(stringA: String): Sequence<AbstractUnit> {
val stringToCompare = stringA.lowercase()
val stringToCompare = stringA.trim().lowercase()
// We don't need units where name is too different, half of the symbols is wrong in this situation
val threshold: Int = stringToCompare.length / 2
// List of pair: Unit and it's levDist