Skip to content

Commit 4105c2b

Browse files
committed
Use existing trim function for search terms instead of using a new function removeLastCharacterIfWhitespace
1 parent a4cd3a2 commit 4105c2b

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/CountrySelectorCommand.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ final class CountrySelectorCommand: ObservableListSelectorCommand {
4848
return data = countries
4949
}
5050

51-
// iOS predictive text on keyboard adds an empty space after the word, what makes the term not being found
52-
let normalizedString = String.removeLastCharacterIfWhitespace(from: term)
53-
data = countries.filter { $0.name.localizedCaseInsensitiveContains(normalizedString) }
51+
data = countries.filter { $0.name.localizedCaseInsensitiveContains(term.trim()) }
5452
}
5553
}

WooCommerce/Classes/ViewRelated/Orders/Order Details/Address Edit/StateSelectorCommand.swift

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ final class StateSelectorCommand: ObservableListSelectorCommand {
4848
return data = states
4949
}
5050

51-
// iOS predictive text on keyboard adds an empty space after the word, what makes the term not being found
52-
let normalizedString = String.removeLastCharacterIfWhitespace(from: term)
53-
data = states.filter { $0.name.localizedCaseInsensitiveContains(normalizedString) }
51+
data = states.filter { $0.name.localizedCaseInsensitiveContains(term.trim()) }
5452
}
5553
}

0 commit comments

Comments
 (0)