机器翻译是我每天必不可少的工具,因为要批量翻译一些资料,在各个翻译引擎的页面上翻译,太慢了,所以我自己买了三家的翻译(google, baidu, tencent) api ,在调用 API 的过程中,发现百度翻译在使用体验上是最差的,他会删除换行的格式,删除自己翻译不了的特殊字符,我同时也把这些问题反馈给了百度翻译,因为我也在百度工作过,希望他们做的更好。
Here,sisthe original orgiven string,old isthe stringthat you want toreplace.newisthe which replaces the old,andnisthe number of times the old replaced.
Note:Ifold isempty,it matches at the beginning of the stringandafter eachUTF-8sequence,yielding up tok+1replacements forak-rune string.Ifn<0,there isno limit on the number of replacements.