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

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




PostPosted: Tue May 16, 2006 4:07 pm   Post subject: 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.
Sponsor
Sponsor
Sponsor
sponsor
xtreemboarder




PostPosted: Tue May 16, 2006 4:10 pm   Post subject: (No subject)

btw i forgot to mention that that example will return "a".

c a n a d a
0 1 2 3 4 5
^
^
Clayton




PostPosted: Tue May 16, 2006 4:14 pm   Post subject: (No subject)

check the Turing Walkthrough's string manipulation tutorial, but basically
Turing:

var word:string:= "Canada"
put word(4)

this will output the letter "a"
xtreemboarder




PostPosted: Tue May 16, 2006 4:24 pm   Post subject: (No subject)

omg man... i couldnt find that anywhere and it ended up to be so simple...

thanks man
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  [ 4 Posts ]
Jump to:   


Style:  
Search: