Android Wechat Support RealaceAll

use RegExp instead of String.replaceAll function.

export function replaceAllFixed(str, oldStr, newStr) {
  return str.replace(new RegExp(oldStr, "gm"), newStr);
}

String.prototype.replaceAll = function (s1, s2) {
  return this.replace(new RegExp(s1, "gm"), s2);
};

已经是2021年了!!!!!!

微信Android客户端还不支持replaceAll函数及部分Promiss Feature. !!!

https://developers.weixin.qq.com/community/develop/doc/0004e2b3b94aa81b2bcb3b9da5b800

Leave a Comment

Your email address will not be published. Required fields are marked *