Computer Science Canada

the index

Author:  masterfenix [ Mon Dec 05, 2005 8:26 pm ]
Post subject:  the index

Hi,
I am testing a user inputs.

say if they want to quit the current proc, they ahve to type in 'quit'

in my proc I have,

code:

var userinput : string
get userinput

if index("quitQUIT", userinput) > 0 then
      return
end if


but now, if the user types in 'qu' or 'q' it automattcally quits.
but if i just test again userinput = 'quit' , and they type in say QuIt then its not gonna work.

I was thinking of making a small function that makes that string into a small case string. that could solve things, but if theres a way to do it with index, please tell me.

Author:  zylum [ Tue Dec 06, 2005 1:03 am ]
Post subject: 

code:

var userinput : string
get userinput

if Str.Lower(userinput) = "quit" then
      return
end if


hope that helps Wink

Author:  MysticVegeta [ Tue Dec 06, 2005 12:15 pm ]
Post subject: 

May I add that works for Turing 4.05 only

Author:  [Gandalf] [ Tue Dec 06, 2005 3:49 pm ]
Post subject: 

And if you don't have it, then you can create your own version, or add this to your program:
Turing:
function Lower (s : string) : string
    var res : string := ""
    for i : 1 .. length (s)
        if "A" <= s (i) and s (i) <= "Z" then
            res += chr (ord (s (i)) + 32)
        else
            res += s (i)
        end if
    end for
    result res
end Lower

Author:  masterfenix [ Tue Dec 06, 2005 10:14 pm ]
Post subject: 

cool. where can i get 4.05, In my turing editor i check for latest updates and 4.04c is the latest one.

should i ask my teacher?


and gandalf, whats your user name on enemony territory. I just downlloaded that game so im 'alright' but im 'masfenix;

Author:  [Gandalf] [ Tue Dec 06, 2005 10:57 pm ]
Post subject: 

The Turing site doesn't host the Turing 4.0.5 download anymore (4.0.5 is aka 4.0.4d), but you might be able to get it from your teacher/school.

As for Enemy Territory, I go by a few names and I've been playing from basically the start. It's a great game. But that's for either Off Topic or Private Messages...


: