Computer Science Canada

Php-like explode and replace?

Author:  AzureFire [ 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!

Author:  Delos [ Sat Jan 28, 2006 2:14 pm ]
Post 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.

Author:  Tony [ Sat Jan 28, 2006 5:21 pm ]
Post 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.

Author:  AzureFire [ Sat Jan 28, 2006 5:27 pm ]
Post subject: 

ok thanks, I'll look into it a little more.


: