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

Username:   Password: 
 RegisterRegister   
 Php-like explode and replace?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
AzureFire




PostPosted: Sat Jan 28, 2006 12:53 pm   Post subject: Php-like explode and replace?

I was wondering if there was a command in Turing that would seperate a string into an array at a certain characher

eg.
code:
In php


$pizza  = "piece1|piece2|piece3|piece4|piece5|piece6";
$pieces = explode("|", $pizza);
echo $pieces[0]; // piece1
echo $pieces[1]; // piece2


as well is there a way to replace letters/numbers/symbols in a string with another letters/numbers/symbol?

Thanks!
Sponsor
Sponsor
Sponsor
sponsor
Delos




PostPosted: Sat Jan 28, 2006 2:14 pm   Post subject: (No subject)

Don't know anything about PHP, but with Turing I'd imagine you'd use a series of index()'s in some nifty functions.
In other words, yes these do exist, but only after you've made them Very Happy.
Tony




PostPosted: Sat Jan 28, 2006 5:21 pm   Post subject: (No subject)

the functions are not pre-made for you, but index() will tell you where the first instance of a substring occurs. You could loop over that to do both desired actions.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
AzureFire




PostPosted: Sat Jan 28, 2006 5:27 pm   Post subject: (No subject)

ok thanks, I'll look into it a little more.
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: