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

24314RE: Unexpected results for IfSame

Expand Messages
  • joy8388608
    Jan 20, 2014
    • 0 Attachment

      I couldn't stand the suspense and found the pattern.


      When there are zero or one quoted items in a string


        ex: This string has zero quoted items

              This string has "one" quoted item


      IfSame works correctly.


      If there are two or more it does not match even though it should.


       ex: This "string" has "two" quoted items


      Surrounding the entire strings with double quotes does not make a difference.


      This qualifies as a bug to my way of thinking. Does anyone else see it differently?


      Joy


      Data

      ------

      00N_options1=cache C:\Users C: /LOG

      "00Q_options1=cache C:\Users C: /LOG"

      01N_options1="cache" C:\Users C: /LOG

      "01Q_options1="cache" C:\Users C: /LOG"

      02N_options1="cache" "C:\Users" C: /LOG

      "02Q_options1="cache" "C:\Users" C: /LOG"

      03N_options1="cache" "C:\Users" "C:" /LOG

      "03Q_options1="cache" "C:\Users" "C:" /LOG"

      x


      Results

      ----------

      MATCH 00N_options1=cache C:\Users C: /LOG

      MATCH 00Q_options1=cache C:\Users C: /LOG

      MATCH 01N_options1="cache" C:\Users C: /LOG

      MATCH 01Q_options1="cache" C:\Users C: /LOG

      NO MATCH 02N_options1="cache" "C:\Users" C: /LOG

      NO MATCH 02Q_options1="cache" "C:\Users" C: /LOG

      NO MATCH 03N_options1="cache" "C:\Users" "C:" /LOG

      NO MATCH 03Q_options1="cache" "C:\Users" "C:" /LOG


      ^!SetWordWrap OFF

      ^!Set %I%=0


      :LoopTop

      ^!Inc %I%

      ^!Set %Value%=^$Getline(^%I%)$

      ^!IfSame "^$StrCopyLeft("^%Value%";1)$" "X" END

      ;^!If ^$StrSize("^$StrTrim("^%Value%")$")$=0 LoopTop

      ^!IfSame "^%Value%" "^%Value%" IFSAMEMATCH else IFSAMENOTMATCH

      :IFSAMEMATCH

      ^!Set %Res%="MATCH"

      ^!Goto C1

      :IFSAMENOTMATCH

      ^!Set %Res%="NO MATCH"

      ^!Goto C1

      :C1

      ^!Jump Text_End

      ^!InsertText ^%Res%^%TAB%^%Value%^%NL%

      ^!Goto LoopTop


    • Show all 5 messages in this topic