Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 the index
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
masterfenix




PostPosted: 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.
Sponsor
Sponsor
Sponsor
sponsor
zylum




PostPosted: 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
MysticVegeta




PostPosted: Tue Dec 06, 2005 12:15 pm   Post subject: (No subject)

May I add that works for Turing 4.05 only
[Gandalf]




PostPosted: 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
masterfenix




PostPosted: 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;
[Gandalf]




PostPosted: 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...
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 6 Posts ]
Jump to:   


Style:  
Search: