
-----------------------------------
AzureFire
Sat Jan 28, 2006 12:53 pm

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.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!

-----------------------------------
Delos
Sat Jan 28, 2006 2:14 pm


-----------------------------------
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 :D.

-----------------------------------
Tony
Sat Jan 28, 2006 5:21 pm


-----------------------------------
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.

-----------------------------------
AzureFire
Sat Jan 28, 2006 5:27 pm


-----------------------------------
ok thanks, I'll look into it a little more.
