On Mon, Jul 5, 2021 at 4:00 PM 'nadashin' via golang-nuts
<golang-nuts@googlegroups.com> wrote:
>
> What is the purpose of having,
>
>   func NewReplacer(oldnew ...string) *Replacer
>
> instead of,
>
>   func NewReplacer(oldnew ...[2]string) *Replacer

It's easier to both write and read
    r := strings.NewReplacer("old1", "new1", "old2", "new2")
than
    r := strings.NewReplacer([2]string{"old1", "new1"},
[2]string{"old2", "new2"})

Ian

-- 
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/CAOyqgcUXdxELJeKM0VFLRGEU_MDKegathQ4UBhbJfZA_KcSeXA%40mail.gmail.com.

Reply via email to