How can I create a SEO friendly dash-delimited url from a string?

后端 未结 12 1532
再見小時候
再見小時候 2020-12-05 19:16

Take a string such as:

In C#: How do I add \"Quotes\" around string in a comma delimited list of strings?

and convert it to:

12条回答
  •  Happy的楠姐
    2020-12-05 20:06

    Solution in shell:

    echo 'In C#: How do I add "Quotes" around string in a comma delimited list of strings?' | \
        tr A-Z a-z | \
        sed 's/[^a-z0-9]\+/-/g;s/^\(.\{1,20\}\).*/\1/'
    

提交回复
热议问题