Jump to content

why aren't these strings equal?


Recommended Posts

Why is this string comparison saying they are not equal?

; Set the working directory if not there now.
    Local $sCurrentDir

    $sCurrentdir = @CRLF & @WorkingDir

    ; Display the working directory.
    MsgBox($MB_SYSTEMMODAL, "", " 2 The current working directory: " & $sCurrentDir)

    Local $sStr1 = $sCurrentDir
    Local $sStr2 = "E:\AUTOITWORK"


; Compare two strings without using case sensitivity.
   Local $iCmp = StringCompare($sStr1, $sStr2)
      MsgBox($MB_SYSTEMMODAL, "", _
        "Comparing " & $sStr1 & " To " & $sStr2 & @CRLF & _
        "StringCompare Result (mode $STR_NOCASESENSE): " & $iCmp)

   If $sCurrentDir <> "E:\AUTOITWORK"  Then
   MsgBox($MB_SYSTEMMODAL, "", " NOT correct directory: ")
          FileChangeDir("E:\AUTOITWORK")
    MsgBox($MB_SYSTEMMODAL, "", "Just changed the dir")
   EndIf

ahhh...  i've made a little  progress.  strlen says one is 13 chars where the other is 15 chars.

what to do next?

ahh..  I have used StringStripWS to make two stripped vars which then compare as the same.

So it was whitespace.

Thank you for the venue to help me work through it...

:)

 

 

Edited by abrogard
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...