1 Reply Latest reply on Feb 8, 2013 1:48 AM by George_Johnson

    Parse a multi-line file?

    TechnoGeek

      Is there a way to get the lines from a multi-line text field into an array - one array element per line?  Each line in the text field ends with one delimiter character (say <CR> or ';'), but that character should not be part of the array element. So:

       

      Multi-line text field:

      dog

      cat

      bird

      bat

      horse

       

       

      Becomes

      a[0]="dog"

      a[1]="cat"

      a[2]="bird"

      a[3]="bat"

      a[4]="horse"

       

      This would be with Acrobat XI.

       

      If the array created is used to populate other text fields, would that work under Adobe Reader?

        • 1. Re: Parse a multi-line file?
          George_Johnson MVP & Adobe Community Professional

          Yes, it will work with Reader. There is a carriage return at the end of each line of a multiline text field, so you can just to this:

           

          var aRows = getField("multiline1").valueAsString.split(/\r/);

           

          But note that if one line wraps to another, there won't be a carriage return at what appears to be the end of the first line.