I have Station Names like 23 St, 21 St
in our mysql database.
I am applying Lucene Algorithm to search the stations in Java.
For 23 St user can give inputs like 23rd St, 23rd etc.
I want to remove Ordinals from the given inputs, like if user gives 23rd St then I want it to replace with 23 St.
So is there any way to remove ordinal value in Java?
This will remove ordinals:
String s = s.replaceAll("(?<=\\d)(rd|st|nd|th)\\b", "");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With