Split string with another string

I’m trying to split up file input I’m reading in from WWW data string. I would like to Split on a string rather than just a character. I know I can do something like:

var localdata : String = wwwfile.data;
// split string into array items based on "#" character
var locItems = localdata.Split( "#"[ 0 ] );

But I would like to do something like:

var localdata : String = wwwfile.data;
var splitter : String = "</>";
// split string into array items based on "</>" tag
var locItems = localdata.Split( splitter ???? );

.NET docs show this should be possible with an additional parameter of type System.StringSplitOptions but Unity doesn’t seem to be happy with this type.

Has anyone done this before and can give me a tip?

thanks!
-s

Here you go:

import System; // For StringSplitOptions enumeration

function Start () {
	var separators : String[] = ["foo", "bar"];
	var text = "12451234123foo123123123123bar123123123foo2123";
	
	var items = text.Split(separators, StringSplitOptions.None);
	
	for (var item in items)
		Debug.Log(item);
}

Cheers,
-Jon

aw geez i was totally declaring my splittter string incorrectly!

thanks jonathan.

-s

Uh, real quick… what if we want to use a line break as one of our seperators? Is there a special code or character for that?