zoukankan      html  css  js  c++  java
  • 查找字符串(富文本)指定元素

    let content = '<title>来自'+ this.userInfo.realName +'的分享</title><content>'+this.shareContent.title+'</content><image>'+
    this.shareContent.imgList[0].url+'</image>'
    /* 聊天页面解析 */
    console.log('解析后的参数');

    --------------------------------------

    “<title>来自杨博文的分享</title>

    <content>测试一下</content>

    <image>http://*****:5000/developtest/20210118/9a020a7967784e24a0d2e7b1efd3b2db.jpg</image>”

    -----------------------------------------------
    let title = this.searchString(content,'title');
    console.log(title);
    let detail = this.searchString(content,'content');
    console.log(detail);
    let imgurl = this.searchString(content,'image');
    console.log(imgurl);
    --------------------------------------------------------------------------------
    searchString(data,document){
    let index = data.indexOf('<'+document+'>');
    let index1 = data.indexOf('</'+document+'>');
    return data.substring(index+document.length+2,index1);
    }

  • 相关阅读:
    这之后的事。。。
    POJ
    POJ
    博客园的装饰
    高斯消元
    逆序数技巧
    各种小的 dp (精)
    最大区间和变形
    树dp 统计异或值
    dp
  • 原文地址:https://www.cnblogs.com/fdxjava/p/14301829.html
Copyright © 2011-2022 走看看