1 Reply Latest reply on Apr 25, 2012 5:56 PM by disabled_JustinClose

    Problem finding end of line in imported text

      Title

      Problem finding end of line in imported text

      Post

      Hello all,

      I am trying to find the end of a line of text.  The text is imported originally from a web form; but it is coming into my FM solution from another DB, not directly from the web form. Visually it looks like this:


      Name:
      Last:

      I am trying to do a check for whether or not the Name field is empty, so I am doing:

      Let ( [
         Start = Position ( $Text ; "Name:"; 1; 1 ) + 6 ;
         EndLine = Position ( $Text ; "¶" ; Start ; 1 ) - 1
               //EndLine should find the CR at end of "Course Name: " line.  Minus 1 to remove that CR
      ] ;

      Middle ( $Text ; Start ; EndLine )

      )

      But when I use Data Viewer to watch this expression, EndLine is turning out to be 65 characters later, and not the 2 or 3 I might expect.  (There is a space character after the colon in "Name:", hence the plus 6.  And I would expect one character for the LF at the end of the line.)  This 65 characters ends up spanning what visually appears to be 4 lines.

       

      In trying to figure out what characters are really there, I was using Code().  I copied the text and pasted it in and got some odd results.  (I removed as many extraneous letters as possible to make the return string shorter.)

      Code ("e:
      L")

       

      = 76000 32000 32000 32000  5800  101

         "L"       " "       " "       " "      ":"     "e"

      Code() appears to return from right to left, so the '101' is the 'e', the '5800' the colon, the "32000" a space, etc.  I put the spaces in between the resulting values to try and make it clearer.  Not 100% sure about those divisions; numbers returned were not a fixed width.

       

      But that means they are just spaces between the colon and the L, despite the fact that it is showing on the next line. Anyone have any ideas what is going on?  Or how to achieve this?

       

      Thanks,

      J