开发者

How do I convert this Python punctuation-stripping function to JavaScript?

开发者 https://www.devze.com 2022-12-31 18:31 出处:网络
Please can any开发者_StackOverflow中文版one translate this python code into javascript. # def strip_punctuation(s):

Please can any开发者_StackOverflow中文版one translate this python code into javascript.

#
def strip_punctuation(s):
#
    for c in ',.":;!%$':
#
        while s.find(c) is not -1:
#
            s.replace(c, '')


function strip_punctuation(s) {
    return s.replace(/[,.":;!%$]/g, "");
}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号