4 Replies Latest reply on Jun 11, 2007 12:55 PM by McFazstp

    How can I create a case sensitive String?

    joaoteste
      Hello
      I am trying to create a scrypt that will compare a String with an editable text that the user should type to match that String. I was able to do that, but the problem is that is not case sensitive, even with the adobe help telling me that strings are case sensitive. Do you guys know how to make that comparison match only if all the field has the right upper and lower case letters?
      ____
      on exitframe

      if field "t:texto1" = "Residencial Serra Verde"then
      go to next
      end if

      end
      |----> thats the one Im using!

      Anyway, any help is welcome!
      Thanks!

      jrsm
        • 1. Re: How can I create a case sensitive String?
          Level 7
          If you put each item that you are comparing into a list, it magically
          makes it case sensitive. Just put list brackets around each item.

          on exitframe

          if [field "t:texto1"] = ["Residencial Serra Verde"] then
          go to next
          end if

          end
          • 2. Re: How can I create a case sensitive String?
            James Newton, ACP Level 3
            The = operator is not case-sensitive when used on strings, but the < and > operators are case-sensitive.

            So another way to do this is to check if the string is neither greater than nor less than the target string:

            vExpected = "Residencial Serra Verde"
            vInput = field "t:texto 1"
            if vExpected < vInput then
            -- ignore
            else if vExpected > vInput then
            -- ignore
            else
            -- vExpected is a case-sensitive match for vInput
            go next
            end if
            • 3. Re: How can I create a case sensitive String?
              joaoteste Level 1
              I tried both the solutions that were given and it didnt work! The second solution given even made my director crash, so anyone have any other ideas for a case sensitive String??
              thanks in advance!
              joao rsm
              • 4. Re: How can I create a case sensitive String?
                McFazstp
                I just tried both solutions and they both worked. When you say that they didn't work do you mean that they still went to the marker when the cases didn't match?

                vExpected = "Residencial Serra Verde"
                vInput = field("t:texto 1")
                if NOT ( (vInput < vExpected) OR (vInput > vExpected) ) then
                put "Less or greater comparison:" && vInput && "case matches" && vExpected
                else
                put "Less or greater comparison:" && vInput && "case doesn't match" && vExpected
                end if
                if ( [vInput] = [vExpected] ) then
                put "List comparison:" && vInput && "case matches" && vExpected
                else
                put "List comparison:" && vInput && "case doesn't match" && vExpected
                end if