Results 1 to 7 of 7

Thread: Compare two strings including case?

  1. #1

    Angry Compare two strings including case?

    I just have a quick question.

    PHP Code:
    x1="Test";
    x2="TEST";
        if (
    x1 == x2)
            {
               
    info("Match!");
            } 
    Why is it when I run this, I get the 'Match" message? Since those variables are of different case, why are they considered the same? Is there something I can do to make it case sensitive?
    Go TEAM VAD!! \/

  2. #2
    (x1 - x2) == ""

    (x1.hash() == x2.hash())

  3. #3
    I was unable to find hash in the reference or user manual for lscript, so I hope you don't mind this question.

    Is .hash() akin to looking at the character codes?
    Go TEAM VAD!! \/

  4. #4
    patch: v1.4.5 released: 04.20.99
    ...
    A new integral object method has been added called hash(). This
    method, useful only with character strings, will return an integer
    value that represents a calculated hash value for that string. The
    array type also responds to this method, and will calculate a hash
    value for all string elements in the array.
    ...

  5. #5
    Originally posted by #lwrs_web
    patch: v1.4.5 released: 04.20.99
    ...
    A new integral object method has been added called hash(). This
    method, useful only with character strings, will return an integer
    value that represents a calculated hash value for that string. The
    array type also responds to this method, and will calculate a hash
    value for all string elements in the array.
    ...
    Cheers, thank you.

    I think that answerr'll help me a lot. I do have one more qusetion, but it's not critical to my scripting here. Couldn't this approach in rare circumstances cause a false match? I mean, if it adds the values together, couldn't you have two strings (not in the upper/lower case consideration...) that are listed as a match end up being different? Like, wouldn't "Ii" == "iI"?

    Just a point of curiosity.
    Go TEAM VAD!! \/

  6. #6
    yes forget this hash... I checked the return values and iI is indeed the same as Ii

    I thought it's something like MD5
    http://userpages.umbc.edu/~mabzug1/cs/md5/md5.html

  7. #7

    Question Are U sure ??

    Hi guys, I've the same pb.
    but.. even if there is the "new" hash() function added in the Release Notes 1.4.5 I've tried it but.... result : "Unresolved function reference: hash()"
    (in the Modeler and in the Layout).
    Why ..?
    I'm workin' on LW8.01


    But this trick :
    var1 = "MotionMixer";
    var2 = "MotionMIxer";

    if((var1 - var2) == "")
    info("Uh Oh ...! Looks like the same.");
    else
    info("Those strings are different.");
    Last edited by °.:Xk-Liber:.°; 09-16-2004 at 04:58 AM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •