Swift 5: How to calculate correct Date from provided string?
问题 I am not good at Swift so I would like to know how to calculate the current time is between two times. I got the following response from the backend. {"workHours":"M-F 9:00 - 18:00"} How to get start (9:00) time, end (18:00) time from "M-F 11:00 - 20:00" response using regular expression and DateFormatter?(I am not sure it is the correct way to get Date object from this kind of string, if not please recommend the best way and experience) 回答1: You can use the following regex: "^\\w-\\w\\s{1}(\