Loading ...
Sorry, an error occurred while loading the content.
 

Last charactr of ^$Getline$

Expand Messages
  • Jean-Fran├žois Colas
    Hello list, I m still using the version 6.2 light here at work. I ve encountered a strange behaviour of ^$Getline$, which is as follows: Considering the four
    Message 1 of 2 , Dec 10, 2013
      Hello list,

      I'm still using the version 6.2 light here at work. I've encountered a
      strange behaviour of ^$Getline$, which is as follows:

      Considering the four lines:
      123c456
      < P
      ---
      > L'

      When I try to get the ascii code of the last character, with:
      ^$CharToDec(^$StrCopyRight(^$Getline$;1)$)$
      for the second line, I get 13 instead of the ascii code of P.

      After different tests, it seems that if the line has exactly three
      characters, I get 13. If the line has two or just one character, I get
      10, as for:
      -
      --
      ---
      ----

      Is it the same with v 7?

      Thanks,
      J.-F.
    • joy8388608
      There does seem to be a problem here. All your examples work fine for me in NoteTab Pro 7.1.0.40 but not in NoteTab Light 7.1.0.37. Using 8 lines of data
      Message 2 of 2 , Dec 12, 2013

        There does seem to be a problem here.

        All your examples work fine for me in NoteTab Pro 7.1.0.40 but not in NoteTab Light 7.1.0.37.


        Using 8 lines of data


        123c456

        < P

        ---

        > L'

        -

        --

        ---

        ----


        I get
        54, 80, 45, 39, 45, 45, 45, 45 in Pro and
        54, 13, 13, 39, 10, 10, 13, 45 in Light.

        Note that character with Dec value 13 is a  carriage return char (CR) and 10 is a Line Feed (LF) char. These chars are used to terminate lines and are normally not displayed. Different operating systems use just CR or just LF and many use CRLF which display as one character which can be confusing. My favorite way of knowing for sure is looking at the file with a hex editor. (Note 13 in hex is 'D' and 10 in hex is 'A'.)

        Joy

        getfield

        ^!Set %L%=0


        :TOP

        ^!Inc %L%

        ^!Jump ^%L%

        ^!Prompt Line ^%L% Rightmost char -> ^$StrCopyRight(^$Getline$;1)$ ^%NL%Line ^%L% Rightmost char in decimal -> ^$CharToDec(^$StrCopyRight(^$Getline$;1)$)$

        ^!If ^%L% < ^$GetLineCount$ TOP



      Your message has been successfully submitted and would be delivered to recipients shortly.