Skip to content

Commit 70fc3e0

Browse files
committed
Remove the # from order searches
1 parent e091242 commit 70fc3e0

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

WooCommerce/Classes/ViewRelated/Search/Order/OrderSearchUICommand.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,18 @@ final class OrderSearchUICommand: SearchUICommand {
7979

8080
viewController.navigationController?.pushViewController(detailsViewController, animated: true)
8181
}
82+
83+
/// Removes the `#` from the start of the search keyword, if present.
84+
///
85+
/// This allows searching for an order with `#123` and getting the results for order `123`.
86+
/// See https://github.com/woocommerce/woocommerce-ios/issues/2506
87+
///
88+
func sanitize(_ keyword: String) -> String {
89+
guard keyword.starts(with: "#") else {
90+
return keyword
91+
}
92+
return keyword.removing(at: keyword.startIndex)
93+
}
8294
}
8395

8496
private extension OrderSearchUICommand {

0 commit comments

Comments
 (0)