
-----------------------------------
xtreemboarder
Tue May 16, 2006 4:07 pm

charAt for Turing
-----------------------------------
is there a function that can get a single character from a word or phrase... like you give it a number which represents the address (sort of) and it just returns the character... i know theres such a thing in Java which is called charAt... and its a great little tool.

so for example... in Java I would write something like this

String word = "canada";
char ch = word.charAt (3);
c.print (ch);

note that in Java, the first character starts with 0.

-----------------------------------
xtreemboarder
Tue May 16, 2006 4:10 pm


-----------------------------------
btw i forgot to mention that that example will return "a".

c a n a d a
0 1 2 3 4 5
        ^
        ^

-----------------------------------
Clayton
Tue May 16, 2006 4:14 pm


-----------------------------------
check the Turing Walkthrough's string manipulation tutorial, but basically

var word:string:= "Canada"
put word(4)

this will output the letter "a"

-----------------------------------
xtreemboarder
Tue May 16, 2006 4:24 pm


-----------------------------------
omg man... i couldnt find that anywhere and it ended up to be so simple... 

thanks man
