Computer Science Canada

Capitals and lowercase letters in the get statement

Author:  dampflames [ Thu Sep 30, 2004 2:27 pm ]
Post subject:  Capitals and lowercase letters in the get statement

How can you make the program ignore the lowercase/uppecase difference in words?

Author:  wtd [ Thu Sep 30, 2004 2:32 pm ]
Post subject: 

Create functions which convert all characters to uppercase or lowercase.

code:
function upperCase(input : string) : string
   % ...
end upperCase

Author:  Dan [ Thu Sep 30, 2004 3:06 pm ]
Post subject: 

or you could use the bulit in ones Rolling Eyes

Str.Lower and Str.Upper

Author:  wtd [ Thu Sep 30, 2004 3:30 pm ]
Post subject: 

Nifty.

Still, creating the functiopns would be a great exercise in character arithmetic. Can you manipulate ASCII characters in Turing like you can in C++ and other languages?

Author:  rizzix [ Thu Sep 30, 2004 3:48 pm ]
Post subject: 

hmm such as..? char s = 'a' + 5;

well if ur talking about something like that.. heh noo. its pretty strict and type safe.

Author:  wtd [ Thu Sep 30, 2004 4:05 pm ]
Post subject: 

There aren't even any functions to convert back and forth?

The most type-safe languages available have those.

Author:  Mazer [ Thu Sep 30, 2004 4:43 pm ]
Post subject: 

rizzix wrote:
hmm such as..? char s = 'a' + 5;

well if ur talking about something like that.. heh noo. its pretty strict and type safe.

Something like that can be done, for the same effect.

char s := chr(ord('a') + 5)

I think...
Don't have a copy of turing here to test it.

Author:  wtd [ Thu Sep 30, 2004 4:46 pm ]
Post subject: 

Coutsos wrote:
rizzix wrote:
hmm such as..? char s = 'a' + 5;

well if ur talking about something like that.. heh noo. its pretty strict and type safe.

Something like that can be done, for the same effect.

char s := chr(ord('a') + 5)


Beautiful.

code:
let s = char_of_int (int_of_char 'a' + 5)


Wink

Author:  Mazer [ Thu Sep 30, 2004 4:48 pm ]
Post subject: 

Heh, pretty much. I'm not sure if it can be done better...

Author:  wtd [ Thu Sep 30, 2004 4:56 pm ]
Post subject: 

code:
s = ('a'[0] + 5).chr

Author:  the_short1 [ Thu Sep 30, 2004 6:36 pm ]
Post subject: 

i have turing..
put chr(ord('a') + 5)
produces the letter 'f' ..perfect!

Author:  rizzix [ Thu Sep 30, 2004 7:45 pm ]
Post subject: 

yea wtd they do have fuctions to convert between formats.. ehm nvm.. u've already figure it out: ord

Author:  the_short1 [ Fri Oct 01, 2004 10:35 pm ]
Post subject: 

thx u guys tho...

i learnt something new..
believe it or not... i never really 'learned' ord..

that day of class... i kinda got someone else to do it cuz i was really tired.. and i much rathared listen to musik and not do any work.. Wink


: