indexOf和replace的用法及案例

    xiaoxiao2025-07-15  13

    indexOf用法 : var str = "abcdefg" str.indexOf("a")    // 0 //如果不存在会返回 -1 //如果存在会返回该字符在字符串中的位置1234 replace用法 : var str = "a b c d" str.replace("a", "x")  cc.log(str) // "a b c d"1234var str = "a b c
    转载请注明原文地址: https://ju.6miu.com/read-1300709.html
    最新回复(0)