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

7571Re: [Clip] Replacing characters in a variable

Expand Messages
  • Alan C.
    Oct 3, 2001
      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.
    • Show all 10 messages in this topic