2 Replies Latest reply on Jan 16, 2017 1:57 PM by Obi-wan Kenobi

    Code to be evaluated! [014]  Words reversed in each para! …

    Obi-wan Kenobi Adobe Community Professional

      Hi Scripters,

       

      Some misunderstanding! ... I can't find my error:

       

      var mySel = app.selection[0],
      myParas = mySel.contents.split("\r"),
      P = myParas.length;
      for ( var p = 0 ; p < P-1 ; p++ )
          {
              var myPara = myParas[p];
              myWords = myPara.split(" ");
              myNewWords = myWords.reverse();
              myPara = myNewWords.join(" ");
          }
      myNewParas = myParas.join("\r");
      mySel.contents = myNewParas;
      

       

      I have selected several paras and I would like to reverse the words per each para!

       

      Thanks in advance! 

       

      (^/)