2019-10-18 js匹配某(dou)音自定义字体图标转正常字符

文本是某音网站上面的iconfont_31180f7.svg文件 unicode
https://www.douyin.com/share/user/59782860869?share_type=link

function castString(str) {
      switch (str) {
        case "":
        case "":
        case "":
          return 0;
        case "":
        case "":
        case "":
          return 1;
        case "":
        case "":
        case "":
          return 2;
        case "":
        case "":
          return 3;
        case "":
        case "":
        case "":
          return 4;
        case "":
        case "":
        case "":
          return 5;
        case "":
        case "":
        case "":
          return 6;
        case "":
        case "":
        case "":
          return 7;
        case "":
        case "":
        case "":
          return 8;
        case "":
        case "":
        case "":
          return 9;
        default:
          return str;
      }
    }
// 抖音id
shortid = $(".shortid").text().split("").map(n => castString(n)).join("").replace(/ /g, "");
// 关注人数
focus = $(".focus").text().split("").map(n => castString(n)).join("").replace(/ /g, "");
//粉丝数量
follower = $(".follower").text().split("") .map(n => castString(n)).join("").replace(/ /g, "");
// 点赞人数
likednum = $(".liked-num").text().split("").map(n => castString(n)).join("").replace(/ /g, "");

你可能感兴趣的:(2019-10-18 js匹配某(dou)音自定义字体图标转正常字符)