Interesting, I didn't know strings.Map could work this way, I have done a performance benchmark with PHP 7 Pcre2 C is 1,020 nanoseconds and strings.Map version is 2,888 nanoseconds, not bad improvement over regexp. If there is a better approach, however, Rust Re2 is just as fast as PHP Pcre2.
On Monday, 4 May 2020 17:50:15 UTC+8, Tamás Gulácsi wrote: > > 2020. május 4., hétfő 11:26:26 UTC+2 időpontban Vivi a következőt írta: >> >> I like to replace one or more characters to one character e.g. to >> sanitize proper slug title with a dash. >> >> On Monday, 4 May 2020 14:24:26 UTC+8, Tamás Gulácsi wrote: >>> >>> You just want to remove those characters? Use strings.Map. >> >> > See https://play.golang.org/p/dI6ZFG_mzLV for example. > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/0c250bd5-aa0e-4038-bb09-184f796aba7a%40googlegroups.com.