I am writing a CRUD of people in Meteor, and I want pretty URLs like
http://ift.tt/1HI1TId.
(Actually, my real preference would be http://ift.tt/1It4TGn, but the implementation might be a bit more difficult.)
In order to accomplish that, I need to be able to translate from "John-Doe" to "John Doe" and from "John-Doe--Smith"John Doe-Smith".
I could of course use a preliminary replacement of "--" to some temporary character, but looking for a more elegant solution.
(Edit: after writing this, I just realized that I can sanitize the name to collapse multiple white spaces and dashes into one first; but I am now curious about the more generic answer).
Aucun commentaire:
Enregistrer un commentaire