the index
Author |
Message |
masterfenix
|
Posted: 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. |
|
|
|
|
![](images/spacer.gif) |
Sponsor Sponsor
![Sponsor Sponsor](templates/subSilver/images/ranks/stars_rank5.gif)
|
|
![](images/spacer.gif) |
zylum
![](http://compsci.ca/v3/uploads/user_avatars/1689129126468091c334ee0.gif)
|
Posted: Tue Dec 06, 2005 1:03 am Post subject: (No subject) |
|
|
code: |
var userinput : string
get userinput
if Str.Lower(userinput) = "quit" then
return
end if |
hope that helps ![Wink Wink](http://compsci.ca/v3/images/smiles/icon_wink.gif) |
|
|
|
|
![](images/spacer.gif) |
MysticVegeta
![](http://www.geocities.com/ohsoinsane/my_avatar.JPG)
|
Posted: Tue Dec 06, 2005 12:15 pm Post subject: (No subject) |
|
|
May I add that works for Turing 4.05 only |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Tue Dec 06, 2005 3:49 pm Post subject: (No 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 |
|
|
|
|
|
![](images/spacer.gif) |
masterfenix
|
Posted: Tue Dec 06, 2005 10:14 pm Post subject: (No 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; |
|
|
|
|
![](images/spacer.gif) |
[Gandalf]
![](http://compsci.ca/v3/uploads/user_avatars/189297994e4c716fec7f1.png)
|
Posted: Tue Dec 06, 2005 10:57 pm Post subject: (No 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... |
|
|
|
|
![](images/spacer.gif) |
|
|