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

string length: Bug in version 7?

Expand Messages
  • Axel Berger
    I just stumbled over something strange: ^$StrSize( string )$ reports one byte more than the string is actually long. I ve only tested this for a string stored
    Message 1 of 4 , Aug 2, 2012
    • 0 Attachment
      I just stumbled over something strange:

      ^$StrSize("string")$ reports one byte more than the string is actually
      long. I've only tested this for a string stored in ^%array%^%position%.

      Axel

      --
      Dipl.-Ing. F. Axel Berger Tel: +49/ 2174/ 7439 07
      Johann-H├Ąck-Str. 14 Fax: +49/ 2174/ 7439 68
      D-51519 Odenthal-Heide eMail: Axel-Berger@...
      Deutschland (Germany) http://berger-odenthal.de
    • flo.gehrke
      ... Axel, I ve tested... ^!SetArray %Array%=Fritz;Hans;Joe ^!Info [L]Fritz=^$StrSize(^%Array1%)$^PHans=^$StrSize(^%Array2%)$^PJoe=^$StrSize(^%Array3%)$ ...and,
      Message 2 of 4 , Aug 2, 2012
      • 0 Attachment
        --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
        >
        > I just stumbled over something strange:
        >
        > ^$StrSize("string")$ reports one byte more than the string is actually
        > long. I've only tested this for a string stored in ^%array%^%position%.
        >
        > Axel

        Axel,

        I've tested...

        ^!SetArray %Array%=Fritz;Hans;Joe
        ^!Info [L]Fritz=^$StrSize(^%Array1%)$^PHans=^$StrSize(^%Array2%)$^PJoe=^$StrSize(^%Array3%)$

        ...and, for me, it outputs correct results.

        Maybe you should give us more details in case it's still happening...

        Regards,
        Flo
      • Axel Berger
        ... I have to shamefully admit, not to have done any testing beyond my special case. I have just extracted the relevant lines from my actual clip. Take the one
        Message 3 of 4 , Aug 2, 2012
        • 0 Attachment
          "flo.gehrke" wrote:
          > ...and, for me, it outputs correct results.
          > Maybe you should give us more details in case it's still happening...

          I have to shamefully admit, not to have done any testing beyond my
          special case. I have just extracted the relevant lines from my actual
          clip. Take the one line text

          ---------------------------------------------------------------
          author = {Kopka, Helmut},

          ---------------------------------------------------------------

          and run this clip:

          ---------------------------------------------------------------
          ^!SetListDelimiter " AND "
          ^!Jump TEXT_START
          ^!Find "^ author = \{(.+)\},$" RSTI1
          ^!IfError autdone
          ^!Continue ^$StrSize("^$GetSelection$")$ ^$GetSelection$
          ^!SetArray %autarr%=^$GetSelection$
          ^!Set %for%=1
          ^!Continue ^$StrSize("^%autarr%^%for%")$ ^%autarr%^%for%
          :autdone
          ---------------------------------------------------------------

          For me the two continues show:
          13 Kopka, Helmut
          14 Kopka, Helmut1

          Axel

          P.S: Dumbness alert:
          Is it possible I'm just too stupid and the correct syntax here is
          ^%autarr^%for%% not ^%autarr%^%for%?

          If so I apologize for having wasted everyone's time.
        • flo.gehrke
          ... Correct! The last line has to be... ^!Continue ^$StrSize( ^%autarr^%for%% )$ ^%autarr^%for%% Now the size of Kopka, Helmut is 13 in both cases. In your
          Message 4 of 4 , Aug 2, 2012
          • 0 Attachment
            --- In ntb-clips@yahoogroups.com, Axel Berger <Axel-Berger@...> wrote:
            >
            > Is it possible I'm just too stupid and the correct syntax here
            > is ^%autarr^%for%% not ^%autarr%^%for%?

            Correct! The last line has to be...

            ^!Continue ^$StrSize("^%autarr^%for%%")$ ^%autarr^%for%%

            Now the size of 'Kopka, Helmut' is 13 in both cases.

            In your first version, it also counted '%'.

            > If so I apologize for having wasted everyone's time.

            Never mind, we all learn from our mistakes ;-)

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