1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

How to? Comparing strings with blanks

Discussion in 'Support' started by fpefpe, Oct 16, 2013.

  1. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Hello –

    A pointer or 2 on this would be appreciate –

    I have a few network drives that I map to my system, so I wrote a btm file to make sure the
    correct drive is mapped to the correct drive letter

    The label on one drive is and I have its label in the following line in the btm file

    set s2=Base (at NAS-02)

    in the script I use @label function to get the label of the drive, in this case m:, that this drive
    should map at

    the results of the @label function seems to be returning the string noted in var s2, but when
    I issued the command (var ll had the results of @label)

    if “%s2" == “%ll”

    the results is false – I could not figure out if there were characters in there that I could not see like a tab

    I then use the @md5 function to turn each string in to a hex string value and these values compared to be true –

    Any pointers on how to figure out why the s2 and ll did not compare to be the same?

    Thanks
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,287
    Likes Received:
    39
    I think I'd try plugging each into @UNICODE and examining the returns.
     
  3. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Thanks for the info
     
  4. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    I can't reproduce a problem. o: is an external hard drive.
    Code:
    v:\> echo %@label[o:]
    WD (wd)
    
    v:\> set ll=%@label[o:]
    
    v:\> set s2=WD (wd)
    
    v:\> if %s2 == %ll echo yes
    yes
    
    v:\> if "%s2" == "%ll" echo yes
    yes
     
  5. fpefpe

    Joined:
    Oct 18, 2008
    Messages:
    238
    Likes Received:
    1
    Thanks for trying this out -- @unicode generated the name set of numbers for each character -- the "==" or "EQ" is a case neutral compare?
     
  6. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,523
    Likes Received:
    4
    YES. The only case sensitive string comparison operator is EQC (the C refers to CASE). All other string comparison operators are case insensitive. Legacy of COMMAND.COM
     

Share This Page