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

13178Re: String Interpretation (was ^!If Bug ?)

Expand Messages
  • acummingsus
    Jan 7, 2005
      --- In ntb-clips@yahoogroups.com, "John Mitchell" <notetab@l...>
      wrote:
      [ . . ]
      >
      > ^!Set %a%="ASDF"
      > ^!Set %b%="ZXCV"
      > ^!Set %c%=^%a%^%b%
      > ^!Set %d%=^%a%"ZXCV"
      > ^!Info ^%a%^%b%
      > ; .......... Displays ASDFZXCV (expected)
      > ^!Info ^%c%
      > ; .......... Displays ASDFZXCV (expected)
      > ^!Info ^%d%
      > ; .......... Displays ASDF"ZXCV" (inconsistent?)
      >
      > For consistency, I'd expect quotes to *always* be treated as string
      > delimeters unless escaped. This is apparently not the case.

      The string is *everything* to the right of the =

      Therefore, you only quoted a *part* of the string in: ^!Set %d%=^%
      a%"ZXCV"

      To the right of the = Ntab does its best to make
      all_to_the_right_of_the_= into your string of the contents of
      whatever variable name that's on the left side of the =

      (Since *string* is *all*_to_the_right_of_the_=):

      if U did not want quotes in your string: ^!Set %d%="^%a%ZXCV"

      if U did want quotes in your string: ^!Set %d%="^%a%"ZXCV""

      so it is not: either the quote is a string delimiter or not a string
      delimiter. The picture is not that simple. Very key is that
      *context* is involved; for instance, what is the *context* in which
      the quotes are used.

      ---
      Try Perl if you really want context stuff; by comparison, Notetab has
      very little. I still scratching my head over the many many and
      differing context things in Perl.
      --- (end_of_Perl, back to Ntab once again),

      When what will become a string (all quoted, not just a part of the
      string quoted) is quoted, this is the context in which the quote
      serves to act as string delimiter.

      Have you seen Jody's ClipClass?

      It used to available as zip file for download from his site at
      www.notetab.net

      The Notetab help file is not meant to learn/tutorial non programmer
      newbies; it assumes at least a little former scripting/programming
      experience. But, ClipClass is targeted to the newbie I used it and
      it worked very well for me.

      ^!Set %a%="ASDF"
      ^!Set %b%="ZXCV"
      ^!Set %c%=^%a%^%b%
      ;^!Set %d%="^%a%"ZXCV""
      ^!Set %d%="^%a%ZXCV"
      ^!Set %e%=ONE"TWO"
      ^!Set %f%="THREEFOUR"
      ^!Info ab^%NL%^%NL%^%a%^%b%
      ; .......... Displays ASDFZXCV (expected)
      ^!Info c^%NL%^%NL%^%c%
      ; .......... Displays ASDFZXCV (expected)
      ^!Info d^%NL%^%NL%^%d%
      ; ..........
      ^!Info e^%NL%^%NL%^%e%
      ^!Info f^%NL%^%NL%^%f%

      --
      Alan.
    • Show all 21 messages in this topic