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

Username:   Password: 
 RegisterRegister   
 range of letters help? plz
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
pokerface




PostPosted: Thu Nov 18, 2004 7:17 pm   Post subject: range of letters help? plz

i want to make a if statement that has a range of letters
example:
code:
if word (i) = (*a* all the way to *z*) then etc...

how do i do this?
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Thu Nov 18, 2004 7:42 pm   Post subject: (No subject)

code:

put "A to Z : ", ord ('A'), " to ", ord ('Z')
put "a to z : ", ord ('a'), " to ", ord ('z')
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
wtd




PostPosted: Thu Nov 18, 2004 7:44 pm   Post subject: Re: range of letters help? plz

pokerface wrote:
i want to make a if statement that has a range of letters
example:
code:
if word (i) = (*a* all the way to *z*) then etc...

how do i do this?


code:
if ord (input) >= ord ('a') and ord (input) <= ord ('z') then
   put "lower-case character"
end if
pokerface




PostPosted: Thu Nov 18, 2004 7:54 pm   Post subject: (No subject)

Thanks You guys rock! that was very useful! i could do the same thing with symbols right?
well ill just have to experiment! but thanks for ur time! thanks!!!!!
wtd




PostPosted: Thu Nov 18, 2004 8:19 pm   Post subject: (No subject)

Consider:

code:
function isBetween (ch, first, last : char) : boolean
   result ord (ch) >= ord (first) and ord (ch) <= ord (last)
end isBetween


code:
if isBetween ('M', 'A', 'Z') then
   % yada yada
end if
pokerface




PostPosted: Thu Nov 18, 2004 10:20 pm   Post subject: (No subject)

thanks! that was useful 2!
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: