给英文文章加音标,建生词表

先上个效果图

10. That's Why
Jimmy/ˈʤɪmi/ 吉米more/mɔː/ adj.更多的adv.更
started/ˈstɑːtɪd/[start]v.开始,着手,发动were/wɜː/ (be/biː/ was/were been)
v.是,存在
painting/ˈpeɪntɪŋ/ n.画,绘画(艺术)different/ˈdɪfrənt/ adj.不同的,各种
three/θriː/ num.三other/ˈʌðə/ adj.其他的,别的
years/jɪəz/[year]n.年,年度because/bɪˈkɒz/ conj.因为,由于
old/əʊld/ adj.老的,...岁的never/ˈnevə/ adv.从不,永不,未曾
five/faɪv/ num.五paper/ˈpeɪpə/ n.纸,报纸,文件
already/ɔːlˈredi/ 已经half/hɑːf/ n.一半adv.一半
good/gʊd/ adj.好的,善良的always/ˈɔːlweɪz/ adv.总是,始终
also/ˈɔːlsəʊ/ adv.也empty/ˈempti/ adj.空的,空虚的
got/gɒt/ (get/get/ got gotten)
v.获得,记住,到达
clever/ˈklevə/ adj.聪明的,灵巧的
many/ˈmeni/ adj.许多的n.许多everybody/ˈevrɪbɒdi/ 每个人
prizes/ˈpraɪzɪz/[prize]n.奖品,奖赏Nobody/ˈnəʊbədi/ prep.谁也不
painted/ˈpeɪntɪd/[paint]n.涂料,油漆v.刷漆else/els/ adj.别的adv.否则
beautiful/ˈbjuːtəfʊl/ adj.美丽的,绝妙的does/dʌz/[do]v.做,干,足够,制作
interesting/ˈɪntrɪstɪŋ/ adj.有趣的believed/bɪˈliːvd/[believe]v.相信,认为
pictures/ˈpɪkʧəz/[picture]n.图片,画,照片pioneer/ˌpaɪəˈnɪər/ n.先驱者v.倡导
people/ˈpiːpl/ n.人们,人民,人员day/deɪ/ n.一天,白天
paid/peɪd/ (pay/peɪ/ paid paid)
v.支付n.工资
somebody/ˈsʌmbədi/ 某人
lot/lɒt/ n.许多,地adv.相当bought/bɔːt/ (buy/baɪ/ bought bought)
v.买,购买
money/ˈmʌni/ n.金钱,货币,财富Please/pliːz/ v.使高兴,喜欢,请
them/ðem/ 他们tell/tel/ v.告诉,讲,说出
said/sed/ adj.上述的,该paint/peɪnt/ n.涂料,油漆v.刷漆
boy/bɔɪ/ n.男孩,小伙子bottom/ˈbɒtəm/ n.底部,末尾
famous/ˈfeɪməs/ adj.著名的top/tɒp/ n.顶,盖子v.高于
little/ˈlɪtl/ adj.小的,一点,少的small/smɔːl/ adj.小的,不重要的
older/ˈəʊldə/[old]adj.老的,...岁的brushes/ˈbrʌʃɪz/[brush]n.刷子,画笔v.刷
then/ðen/ adv.当时,然后,那么reach/riːʧ/ v.到达,伸手,够到
sell/sel/ v.卖,出售high/haɪ/ adj.高的,高度的
these/ðiːz/ 这些

 下面是具体的步骤:

1、打开微信小程序-复制就好

 

2、选择

 看到上面的说明按照这个说明去操作就能得到结果。

简单一点就是复制两次,第一次复制单词带音标的格式,第二次复制文字,点运行;点第一次粘贴启动(获得音标在上面的样子),第2次粘贴启动(获取excle的样子,其实是一个string,只是多了空格和回车,变成了两行的样子)

里边有源码,可以改成你要的样子,比如excle搞成4列,我这里有个简单的解释库。

可以自己建个库,用excel的vlookup去匹配。但是这个生成音标的过程和获取单词的过程用vba写起来还是很累的。

---下面是小程序中的源码,应该没什么依赖

testabc(){//’s还是没有处理,与网站的处理策略不一样,比如it's,网上直接看成一个单词,我这边还是看出单词+标点+单词;
    let app=this
    var result ='ok'
    let isnoblank=true;//true表示如果没有翻译出来,就用空白替换,如果是false,就用原文替换
    let iscutword=true;//true,2个字母或者cutword简单字母的,不标音标,比如a an the,如果是false,就用全部标注
    let learnword='dad+mom+can+too+may+thank++way+home+with+very+much+mrs+ours+one+all+could+would+any+why+going+out+from+next+that+this+there+after+'
    let delword='couldn+doesn+karen+shouldn+hadn+wasn+haven+wouldn+don+isn+aren+weren+hasn+cann+sally+';//+结尾
    let cutword='did+not+and+when+was+her+has+the+are+our+you+where+who+what+which+USA+gdp+there+but+his+she+him+hers+your+yours+for+they'//不想标注音标的
    cutword=learnword+delword+cutword;
    let cutarr=cutword.toLowerCase().split("+")//分割一下,要不然hey这样的单词也可能不显示
    let wordFont='"Arial"'//正文字体,有引号注意
    let wordFontsize='"24"'//24等于12磅字,除以2,有引号
    let newwordFont='Arial Unicode MS'//正文字体,没引号
    let newwordFontsize='hps20'//20等于10磅字,除以2,建议24配20,类似这样小20%,常规来说单词比音标短,而且应标还有分割符号
    let newwordFonthigh='up 11'//11表示24/2-1,距离是0,这个24是word的尺寸,如果是40,那么要填写19
    //wordtemplatee=`  <?xml 有空格是不行的
    let wordtemplate=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <?mso-application progid="Word.Document"?>
    <w:wordDocument xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml">
    <w:docPr>  <w:view w:val="print"/> <w:zoom w:percent="120"/>     </w:docPr>    
    <w:body> <w:p> <w:r>  </w:r> </w:p>   </w:body>    <w:sectPr>    </w:sectPr>    </w:wordDocument>`
    let wpbegin='<w:p>'
    let wpend='</w:p>'
    let bodyend='</w:body>'
    let outstr=''
    let word=''
    let nword=''
    let mword=''
    let wordshow=''
    let arrword=[]
    let arroutw=[]
    let isre=false
    let bk4='    '//空4个
    let str=''
    let copyStr=app.data.copyArr[0]//获取剪贴板数据,第一次复制,获取音标和单词的对应关系
    let inarr=copyStr.split("\r\n")
    let isfirst=true// 数据必须是 单词,英标;这样的形式,不能是
    let iscut=false;
  for(let m=0;m<inarr.length;m++)
  {
    str=inarr[m]
    if(str.trim()==''&&isfirst)
    {}else
    {isfirst=false
     if(app.isaz(str)){
     if(inarr[m]==inarr[m+1]&&isnoblank) {outstr=outstr+'"'+str+'":"'+''+'",'; } 
     else  { inarr[m+1]=app.replaceall(inarr[m+1],'ɛ','e');
       outstr=outstr+'"'+str+'":"'+inarr[m+1]+'",';}
     m++;
     }
    }
  }
  outstr="{ "+outstr.slice(0,-1)+" }"
  let jnew=JSON.parse(outstr)// 获取音标结束
  outstr='';
    let copyword=wordtemplate
    let easyword='<w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:t>easyword</w:t></w:r>'
    easyword=app.replaceall(easyword,'"Arial"',wordFont)
    easyword=app.replaceall(easyword,'"24"',wordFontsize)
    let oneword=`<w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:fldChar w:fldCharType="begin"/></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:instrText> EQ \\* jc0 \\* &quot;Font:Arial Unicode MS&quot; \\* hps22 \\o \\ad(\\s \\up 11(upword),downword)</w:instrText></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:fldChar w:fldCharType="separate"/></w:r><w:r><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:cs="Arial" w:hint="fareast"/><w:sz w:val="24"/><w:sz-cs w:val="24"/><w:lang w:val="EN-US" w:fareast="ZH-CN"/></w:rPr><w:fldChar w:fldCharType="end"/></w:r>`
    oneword=app.replaceall(oneword,'"Arial"',wordFont)
    oneword=app.replaceall(oneword,'"24"',wordFontsize)
    oneword=app.replaceall(oneword,'"Arial Unicode MS"',newwordFont)
    oneword=app.replaceall(oneword,'hps22',newwordFontsize)
    oneword=app.replaceall(oneword,'up 11',newwordFonthigh)
    let bl=copyword.indexOf(wpbegin)
   let bodybegin=copyword.slice(0,bl)
   let el=copyword.indexOf(bodyend)
   bodyend=copyword.slice(el)
   // 第二次复制,其实就是要复制出段落分割符号
   let wrodarr=app.data.copyArr[1].split("\r\n")
     for(let m=0;m<wrodarr.length;m++)
     {
       str=wrodarr[m];
     //  console.log(str)
       if(str.trim()==''){continue}
       outstr=outstr+wpbegin+easyword.replace('easyword',bk4);//开头加上4个空格
       for(let i=0;i<str.length;i++)
       {
       if(app.isaz(str.charAt(i))){word=word+str.charAt(i)}
       else{
          if(word.trim()!=='')
          {nword=jnew[word];// 如果找不到或者空格,就简单替换
            if(word.length<3||cutarr.indexOf(word.toLowerCase())!==-1){iscut=true;}
            else{iscut=false;
              mword=word.toLowerCase();
              if(app.findphs(mword)!==undefined&&app.findphs(mword).w!==undefined&&app.findphs(mword).w!==''&&word.toLowerCase()!==app.findphs(mword).w)
              {wordshow=word+jnew[word]+'['+app.findphs(mword).w+']'+app.findphs(mword).m+''}
              else{wordshow=word+jnew[word]+' '+app.findphs(mword).m+''}  
              for(let wi=0;wi<arrword.length;wi++)
              { if(arrword[wi]==word.toLowerCase()){isre=true;break}}
              if(!isre) {arrword.push(word.toLowerCase()); arroutw.push(wordshow);}
            }
            if(nword==undefined||nword==''||(iscut&&iscutword)){nword=easyword.replace('easyword',word)}
            else{nword=oneword.replace('upword',nword).replace('downword',word)} 
          } 
      outstr=outstr+nword+easyword.replace('easyword',str.charAt(i));
      word='';nword='';wordshow='';mword='';   isre=false 
       }
      
       if(i==str.length-1)//最后一个可能是标点,也可能直接是单词,如果是标点word='',如果是单词,加上单词
       {
        if(word.trim()!=='')
        {nword=jnew[word];// 如果找不到或者空格,就简单替换
          if(word.length<3||cutarr.indexOf(word.toLowerCase())!==-1){iscut=true;}
          else{iscut=false;
            mword=word.toLowerCase();
            if(app.findphs(mword)!==undefined&&app.findphs(mword).w!==undefined&&app.findphs(mword).w!==''&&word.toLowerCase()!==app.findphs(mword).w)
            {wordshow=word+jnew[word]+'['+app.findphs(mword).w+']'+app.findphs(mword).m+''}
            else{wordshow=word+jnew[word]+' '+app.findphs(mword).m+''}  
            for(let wi=0;wi<arrword.length;wi++)
            { if(arrword[wi]==word.toLowerCase()){isre=true;break}}
            if(!isre) {arrword.push(word.toLowerCase()); arroutw.push(wordshow);}
          }
          if(nword==undefined||nword==''||(iscut&&iscutword)){nword=easyword.replace('easyword',word)}
          else{nword=oneword.replace('upword',nword).replace('downword',word)} 
        }
        outstr=outstr+nword+wpend;//最后一个字符后,段落结束,把结束符号给他
        word='';nword='';wordshow='';mword=''; isre=false ;// 处理最后一个字符结束
      }
    }
  }
     
     let li=Math.round(arroutw.length/2)
     word='';
     if(li==(arroutw.length/2)){
     for(let i=0;i<li;i++)
     { word=word+arroutw[i]+'\t'+arroutw[i+li]+'\r\n'; }
    }
    else
    {
      for(let i=0;i<li;i++)
      if(i!==(li-1))
      { word=word+arroutw[i]+'\t'+arroutw[i+li]+'\r\n'; }
      else
      { word=word+arroutw[i]+'\r\n'; }
    }

     outstr=bodybegin+outstr+bodyend
     app.data.outArr=[]
     app.data.outArr.push(outstr);
     app.data.outArr.push(word);
     app.data.outStr=word;//把数据传递出去剪贴板数据
     console.log(jnew)
     app.setData({
       result:'ok' + new Date().getTime()
        });
        wx.setClipboardData({
         data:app.data.outStr,
         success: function(res) {
         },
         fail: function(res) {
         }
       });  
     return 
  
  },
  findphs(str)
  {
  str=str.toLowerCase();
  let js={w:'',m:''}
  if(jsonData.data[str]!==undefined)
  {js.w=str; js.m=jsonData.data[str]; return js}
  // s es ies
  if(str.slice(-1)=="s"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {js.w=str.slice(0,-1); js.m=jsonData.data[str.slice(0,-1)];return js}
  if(str.slice(-2)=="es"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {js.w=str.slice(0,-2); js.m=jsonData.data[str.slice(0,-2)];return js}
  if(str.slice(-3)=="ies"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {js.w=str.slice(0,-3)+'y'; js.m=jsonData.data[str.slice(0,-3)+'y'];return js}
// d ed xxed
  if(str.slice(-1)=="d"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {js.w=str.slice(0,-1); js.m=jsonData.data[str.slice(0,-1)];return js}
  if(str.slice(-2)=="ed"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {js.w=str.slice(0,-2); js.m=jsonData.data[str.slice(0,-2)];return js}
  if(str.slice(-2)=="ed"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {js.w=str.slice(0,-3); js.m=jsonData.data[str.slice(0,-3)];return js} //stopped
  if(str.slice(-3)=="ied"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {js.w=str.slice(0,-3)+'y'; js.m=jsonData.data[str.slice(0,-3)+'y'];return js}
  // ing
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {js.w=str.slice(0,-3); js.m=jsonData.data[str.slice(0,-3)];return js}
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-3)+'e']!==undefined)
  {js.w=str.slice(0,-3)+'e'; js.m=jsonData.data[str.slice(0,-3)+'e'];return js}//move,moving
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {js.w=str.slice(0,-4); js.m=jsonData.data[str.slice(0,-4)];return js}//swimming
  // +er +est
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {js.w=str.slice(0,-2); js.m=jsonData.data[str.slice(0,-2)];return js}
  if(str.slice(-3)=="ier"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {js.w=str.slice(0,-3)+'y'; js.m=jsonData.data[str.slice(0,-3)+'y'];return js}//easier
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {js.w=str.slice(0,-3); js.m=jsonData.data[str.slice(0,-3)];return js}//bigger
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {js.w=str.slice(0,-1); js.m=jsonData.data[str.slice(0,-1)];return js}// nicer
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {js.w=str.slice(0,-3); js.m=jsonData.data[str.slice(0,-3)];return js}//tallest
  if(str.slice(-4)=="iest"&&jsonData.data[str.slice(0,-4)+'y']!==undefined)
  {js.w=str.slice(0,-4)+'y'; js.m=jsonData.data[str.slice(0,-4)+'y'];return js}//easiest
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {js.w=str.slice(0,-4); js.m=jsonData.data[str.slice(0,-4)];return js}//biggest
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {js.w=str.slice(0,-2); js.m=jsonData.data[str.slice(0,-2)];return js}//nicest
  //形容词变副词
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {js.w=str.slice(0,-2); js.m=jsonData.data[str.slice(0,-2)];return js}// slowly
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)+'e']!==undefined)
  {js.w=str.slice(0,-2)+'e'; js.m=jsonData.data[str.slice(0,-2)+'e'];return js}// true truly
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)+'le']!==undefined)
  {js.w=str.slice(0,-2)+'le'; js.m=jsonData.data[str.slice(0,-2)+'le'];return js}// true truly// able ably
  if(str.slice(-3)=="ily"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {js.w=str.slice(0,-3)+'y'; js.m=jsonData.data[str.slice(0,-3)+'y'];return js}//happy happily
  if(str.slice(-3)=="lly"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {js.w=str.slice(0,-1); js.m=jsonData.data[str.slice(0,-1)];return js}//smally
  if(str.slice(-4)=="ally"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {js.w=str.slice(0,-4); js.m=jsonData.data[str.slice(0,-4)];return js}//basic basically
  // f fe ves
if(str.slice(-3)=="ves"&&jsonData.data[str.slice(0,-3)+'f']!==undefined)
{js.w=str.slice(0,-3)+'f'; js.m=jsonData.data[str.slice(0,-3)+'f'];return js}/// leaf leaves 
if(str.slice(-3)=="ves"&&jsonData.data[str.slice(0,-3)+'fe']!==undefined)
{js.w=str.slice(0,-3)+'fe'; js.m=jsonData.data[str.slice(0,-3)+'fe'];return js}///  life lives
return js
  /*
  if(jsonData.data[str]!==undefined)
  {return jsonData.data[str]}
  if(str.slice(-1)=="s"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {return jsonData.data[str.slice(0,-1)]}
  if(str.slice(-2)=="es"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {return jsonData.data[str.slice(0,-2)]}
  if(str.slice(-3)=="ies"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {return jsonData.data[str.slice(0,-3)+'y']}
  if(str.slice(-1)=="d"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {return jsonData.data[str.slice(0,-1)]}
  if(str.slice(-2)=="ed"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {return jsonData.data[str.slice(0,-2)]}
  if(str.slice(-2)=="ed"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {return jsonData.data[str.slice(0,-3)]}//stopped
  if(str.slice(-3)=="ied"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {return jsonData.data[str.slice(0,-3)+'y']}
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {return jsonData.data[str.slice(0,-3)]}
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-3)+'e']!==undefined)
  {return jsonData.data[str.slice(0,-3)+'e']}//move,moving
  if(str.slice(-3)=="ing"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {return jsonData.data[str.slice(0,-4)]}//swimming
  // +er +est
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {return jsonData.data[str.slice(0,-2)]}// taller
  if(str.slice(-3)=="ier"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {return jsonData.data[str.slice(0,-3)+'y']}//easier
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {return jsonData.data[str.slice(0,-3)]}//bigger
  if(str.slice(-2)=="er"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {return jsonData.data[str.slice(0,-1)]}// nicer
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-3)]!==undefined)
  {return jsonData.data[str.slice(0,-3)]}//tallest
  if(str.slice(-4)=="iest"&&jsonData.data[str.slice(0,-4)+'y']!==undefined)
  {return jsonData.data[str.slice(0,-4)+'y']}//easiest
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {return jsonData.data[str.slice(0,-4)]}//biggest
  if(str.slice(-3)=="est"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {return jsonData.data[str.slice(0,-2)]}//nicest

  //形容词变副词
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)]!==undefined)
  {return jsonData.data[str.slice(0,-2)]}// slowly
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)+'e']!==undefined)
  {return jsonData.data[str.slice(0,-2)+'e']}// true truly
  if(str.slice(-2)=="ly"&&jsonData.data[str.slice(0,-2)+'le']!==undefined)
  {return jsonData.data[str.slice(0,-2)+'le']}// able ably
  if(str.slice(-3)=="ily"&&jsonData.data[str.slice(0,-3)+'y']!==undefined)
  {return jsonData.data[str.slice(0,-3)+'y']}//happy happily
  if(str.slice(-3)=="lly"&&jsonData.data[str.slice(0,-1)]!==undefined)
  {return jsonData.data[str.slice(0,-1)]}//smally
  if(str.slice(-4)=="ally"&&jsonData.data[str.slice(0,-4)]!==undefined)
  {return jsonData.data[str.slice(0,-4)]}//basic basically
// f fe ves
if(str.slice(-3)=="ves"&&jsonData.data[str.slice(0,-3)+'f']!==undefined)
{return jsonData.data[str.slice(0,-3)+'f']}// leaf leaves 
if(str.slice(-3)=="ves"&&jsonData.data[str.slice(0,-3)+'fe']!==undefined)
{return jsonData.data[str.slice(0,-3)+'fe']}//  life lives
*/
  },
  leftNum(str) {
    return str.replace(/[^0-9]/ig,"")
  },
   leftLetter(str) {
    return str.replace(/[^a-zA-Z]/ig,"")
   },
//判断字符函数 
 isaz(val){ 
  var regPos = /[a-zA-Z]/;  
    if(regPos.test(val)){ 
        return true; 
    }else{ 
        return false; 
    }  
  },

//字符替换函数
replaceall(str, substr, newstr) {
  var p = -1;
  var s = 0; 
    while((p = str.indexOf(substr, s)) > -1) {
    s = p + newstr.length;
    str = str.replace(substr, newstr);
  }
    return str;
},

  • 2
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值