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

Re:[Clip] Replacing characters in a variable

Expand Messages
  • Elizabeth Wild
    Mark, Here is how I would do it: ^!Set %test%= The heavens declare ^!Set %test%=^$StrReplace( e ; X ; ^%test% ;False;false)$ The two falses stand for case
    Message 1 of 10 , Oct 3, 2001
    • 0 Attachment
      Mark,

      Here is how I would do it:

      ^!Set %test%="The heavens declare"
      ^!Set %test%=^$StrReplace("e";"X";"^%test%";False;false)$

      The two 'falses' stand for case sensitive and whole word.

      Come to think of it, I have question. Is it possible to do shorthand for the case sensitive and whole word (T or F/1 or 0/etc)?

      Elizabeth

      Original message from: "Mark Halsall"
      >Is there a simple way to replace characters within a variable? I
      >guess this is either very easy or very difficult, but I can't think
      >how to do it.
      >
      >For example, if
      >%test% contains "The heavens declare"
      >
      >I want to change it so
      >%test% contains "ThX hXavXns dXclarX"
      >
      >Regards,
      >Mark
      >
      >
      >
      >
      >
      >
      >
      >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
      >
      >
    • Harvey R. Savage
      ... Hello Elizabeth, Yes it is possible, Zeroes and Ones (0 1) work fine. hrs
      Message 2 of 10 , Oct 3, 2001
      • 0 Attachment
        Elizabeth Wild wrote:
        >
        > Mark,
        >
        > Here is how I would do it:
        >
        > ^!Set %test%="The heavens declare"
        > ^!Set %test%=^$StrReplace("e";"X";"^%test%";False;false)$
        >
        > The two 'falses' stand for case sensitive and whole word.
        >
        > Come to think of it, I have question. Is it possible to do shorthand for the case sensitive and whole word (T or F/1 or 0/etc)?
        >
        > Elizabeth
        >
        > >
        > >
        Hello Elizabeth,

        Yes it is possible, Zeroes and Ones (0 1) work fine.

        hrs
      • Ray Shapp
        Harvey, I read Help on Clip Language - Text Processing and searched for wholeword but found no info. What does a true value for wholeword accomplish
        Message 3 of 10 , Oct 3, 2001
        • 0 Attachment
          Harvey,

          I read Help on "Clip Language - Text Processing" and searched for
          "wholeword" but found no info. What does a "true" value for "wholeword"
          accomplish in string functions?

          Thanks for the help.

          Ray Shapp
          Watchung, NJ
        • Alan C.
          ... Due to changing only a character, the whole word option would not apply in Mark s example of this thread. However, given in a long enough string, change
          Message 4 of 10 , Oct 3, 2001
          • 0 Attachment
            >"wholeword" but found no info. What does a "true" value for "wholeword"
            >accomplish in string functions?

            Due to changing only a character, the whole word option would not apply in
            Mark's example of this thread.

            However, given in a long enough string, change not a character but instead
            change a word. for example change

            the

            change it to

            gre

            -------

            the whole word option, if activated, would limit the scope to only whole
            words the. In

            theater

            it would not make/convert to

            greater

            --------

            In contrast, if I'm not mistaken, if the whole word option was set at false
            then that leaves it open to also go into portions of larger words and thus
            in this case it would convert

            theater

            would become

            greater

            ---------

            Regards. Alan.
          • Harvey R. Savage
            ... Hi Ray, I assume, 1, true, yes are all affirmative indications while 0, false, no are negative indications. Therefore, in most, if not all places in clip
            Message 5 of 10 , Oct 3, 2001
            • 0 Attachment
              Ray Shapp wrote:
              >
              > Harvey,
              >
              > I read Help on "Clip Language - Text Processing" and searched for
              > "wholeword" but found no info. What does a "true" value for "wholeword"
              > accomplish in string functions?
              >
              > Thanks for the help.
              >
              > Ray Shapp
              > Watchung, NJ
              >

              Hi Ray,

              I assume, 1, true, yes are all affirmative indications while 0,
              false, no are negative indications. Therefore, in most, if not
              all places in clip language either will suffice.

              If I had time right now I would try to scan my MailBag archive to
              locate the email from 1 of these lists, either from Jody or Eric,
              stating same.

              I'll try to locate it later.

              hrs
            • Ray Shapp
              Harvey and Alan: When I ask, What does a true value for wholeword accomplish in string functions? , it is because I don t follow the example Alan gave.
              Message 6 of 10 , Oct 3, 2001
              • 0 Attachment
                Harvey and Alan:

                When I ask, "What does a "true" value for "wholeword" accomplish in string
                functions?", it is because I don't follow the example Alan gave. Also, I'm
                not asking about the various synonyms for Boolean "True" or "False".

                Please make up a clearer example of the use of the "strreplace" function
                which shows how the result differs when the value of "wholeword" is "1"
                versus "0".

                Thanks for your help,

                Ray Shapp
                Watchung, NJ
              • Harvey R. Savage
                ... Hi Ray, I can t answer the query, I don t know what is criteria used, in NoteTab, for determining between wholewords and strings within words. It surely
                Message 7 of 10 , Oct 3, 2001
                • 0 Attachment
                  Ray Shapp wrote:
                  >
                  > Harvey and Alan:
                  >
                  > When I ask, "What does a "true" value for "wholeword" accomplish in string
                  > functions?", it is because I don't follow the example Alan gave. Also, I'm
                  > not asking about the various synonyms for Boolean "True" or "False".
                  >
                  > Please make up a clearer example of the use of the "strreplace" function
                  > which shows how the result differs when the value of "wholeword" is "1"
                  > versus "0".
                  >
                  > Thanks for your help,
                  >
                  > Ray Shapp
                  > Watchung, NJ
                  >
                  Hi Ray,

                  I can't answer the query, I don't know what is criteria used, in
                  NoteTab, for determining between wholewords and strings within
                  words. It surely is more complex than it sounds.

                  Most of the searching I do is not for discrete words, but parts
                  of other strings.

                  I generally make it a practice to always make that setting False,
                  0, no, regardless of what I'm searching for.

                  hrs
                • Alan C.
                  Hi Ray, (apologies for no greeting last time, accidental) ... couple demo clips, would that help. Each of the two clips has identical (same) string which
                  Message 8 of 10 , Oct 3, 2001
                  • 0 Attachment
                    Hi Ray,

                    (apologies for no greeting last time, accidental)

                    >Please make up a clearer example of the use of the "strreplace" function
                    >which shows how the result differs when the value of "wholeword" is "1"
                    >versus "0".

                    couple demo clips, would that help. Each of the two clips has identical
                    (same) string which contains a total of six words. In particular, theater
                    is just one of those six words. Also, notice that "the" is replaced with
                    "cre". And, most importantly of all, is the difference in outcome between
                    the two clips: Each clip has the same identical string, but notice in the
                    output what either happens or does not happen to the word "theater".

                    To answer your question above: as in 1st clip, when value of wholeword is 1
                    it is then that, only certain words, only those words in the string that
                    stand independently are modified.

                    And, as in 2nd clip, when the value of wholeword is 0 it is then that both
                    independently standing words AND ALSO any occurrences from within any
                    larger, longer words that are also modified.

                    So, the difference has to do with whether or not any occurrence that comes
                    from within a larger/longer word gets modified or not.

                    H="streplc_wh_word"
                    ; Last edited:Wednesday, 03 October 2001
                    ^!Set %string%=the theater is near the movies
                    ^!SetWizardTitle Before strreplace task
                    ^!Info ^%string%
                    ^!SetWizardTitle After strreplace task
                    ; ^!Info ^$StrReplace("the";"cre";"^%string%";False;True)$
                    ^!Info ^$StrReplace("the";"cre";"^%string%";False;1)$

                    H="streplc_not_wh_word"
                    ; Last edited:Wednesday, 03 October 2001
                    ^!Set %string%=the theater is near the movies
                    ^!SetWizardTitle Before strreplace task
                    ^!Info ^%string%
                    ^!SetWizardTitle After strreplace task
                    ; ^!Info ^$StrReplace("the";"cre";"^%string%";False;False)$
                    ^!Info ^$StrReplace("the";"cre";"^%string%";False;0)$
                    ; -----<end of clips<<

                    Regards. Alan.
                  • David McIntosh
                    hI I think you just half to set it again eg. set %test% ThX hXavXns dXclarX the variable will change because you reset it. THANKYOU DAVE
                    Message 9 of 10 , Oct 4, 2001
                    • 0 Attachment
                      hI
                      I think you just half to set it again eg.
                      set %test% ThX hXavXns dXclarX
                      the variable will change because you reset it.
                      THANKYOU DAVE

                      Mark Halsall wrote:
                      >
                      > Is there a simple way to replace characters within a variable? I
                      > guess this is either very easy or very difficult, but I can't think
                      > how to do it.
                      >
                      > For example, if
                      > %test% contains "The heavens declare"
                      >
                      > I want to change it so
                      > %test% contains "ThX hXavXns dXclarX"
                      >
                      > Regards,
                      > Mark
                      >
                      >
                      >
                      >
                      > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
                    • Jody
                      Hi Elizabeth, ... 1, as a matter of fact, there is. ;) Yes|No, True|False, 1|0 (True|False respectively) I find the one and zero the easiest. ;) Happy Clip n!
                      Message 10 of 10 , Oct 6, 2001
                      • 0 Attachment
                        Hi Elizabeth,

                        >^!Set %test%="The heavens declare"
                        >^!Set %test%=^$StrReplace("e";"X";"^%test%";False;false)$

                        >Come to think of it, I have question. Is it possible to do
                        >shorthand for the case sensitive and whole word (T or F/1 or
                        >0/etc)?

                        1, as a matter of fact, there is. ;)

                        Yes|No, True|False, 1|0 (True|False respectively) I find the one
                        and zero the easiest. ;)

                        Happy Clip'n!
                        Jody

                        http://www.notetab.net

                        Subscribe, UnSubscribe, Options
                        mailto:Ntb-Clips-Subscribe@yahoogroups.com
                        mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                        http://groups.yahoo.com/group/ntb-clips
                      Your message has been successfully submitted and would be delivered to recipients shortly.