mirror of
https://github.com/Myzel394/NumberHub.git
synced 2025-06-19 08:45:27 +02:00
Trim spaces around search query
This commit is contained in:
parent
78f9d59fd8
commit
18231d0153
@ -76,7 +76,7 @@ abstract class AbstractUnit(
|
|||||||
* @return Sorted sequence of units. Units with lower Levenshtein distance are higher
|
* @return Sorted sequence of units. Units with lower Levenshtein distance are higher
|
||||||
*/
|
*/
|
||||||
fun Sequence<AbstractUnit>.sortByLev(stringA: String): Sequence<AbstractUnit> {
|
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
|
// 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
|
val threshold: Int = stringToCompare.length / 2
|
||||||
// List of pair: Unit and it's levDist
|
// List of pair: Unit and it's levDist
|
||||||
|
Loading…
x
Reference in New Issue
Block a user