I'm having some problems. I have a string : "My wife is pregnant, she can't eat anything, please give me some help ? "; Now: I want to compare this with input from use, who can type freely, i need to compare my string with their string, i must be match to show out their input is wrong or right. Here are some answers from users: " My wife is (1) pregnant, she can't eat anything,(2)please give me some help ?";
1, (1) they have 2 space while i have one, if i compare them together, they are wrong, but the answer is right. 2,(2) i have a space after comma ',' but they don't have it, one more time, if i try to compare,it's wrong Could you guys please give me a standard pattern for my string, and i will replace the input of users to be like my string, and compare them. Here are the right input can be accepted: 1, "My wife is pregnant , she can't eat anything , please give me some help ? "(TRUE) 2," My wife is pregnant , she can't eat anything , please give me some help ? "; (true) then i will use a pattern to format the input to be "My wife is pregnant, she can't eat anything, please give me some help ? ";(my string)
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire