Computer Science Canada

range of letters help? plz

Author:  pokerface [ 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?

Author:  Tony [ Thu Nov 18, 2004 7:42 pm ]
Post subject: 

code:

put "A to Z : ", ord ('A'), " to ", ord ('Z')
put "a to z : ", ord ('a'), " to ", ord ('z')

Author:  wtd [ 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

Author:  pokerface [ Thu Nov 18, 2004 7:54 pm ]
Post 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!!!!!

Author:  wtd [ Thu Nov 18, 2004 8:19 pm ]
Post 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

Author:  pokerface [ Thu Nov 18, 2004 10:20 pm ]
Post subject: 

thanks! that was useful 2!


: