string -> Array (solved)

Hey all,

is there a function to convert a string “abc edf ghi” into an array[0] = “abc” array[1] = “edf” array[2] = “ghi” ? I cannot find it in scriptreference or in the forums.

If there is no function for that, can anyone tell me where i can find String functions like gsub and stuff?

Many thanks.

zem

If you´re using C#, string class has a method that does that. Name is Split.

and is there a similar function in uniscript?

what I want to do is format the data from WWW

function callRealmList() {
	realmList = WWW(realmListURL);
	yield realmList;
	
	test = realmList.data;
	test = test.Split;
	
	print(test[0]);
}

but Split returns me this:

Assets/FxAssets/Zones/realmList/Scripts/RealmList.js(22,21): BCE0022: Cannot convert 'callable(*(char)) as (String)' to 'String'.

print(WWW.data);

Ares	online
Kerates	offline

UnityEngine.Debug:Log(Object)
UnityEngine.MonoBehaviour:print(Object)
$:MoveNext() (at Assets\FxAssets\Zones\realmList\Scripts\RealmList.js:24)

any ideas?

That’s not C#, that’s .NET, which is available for all languages.

You have to say how you want to split it. String.Split docs.

–Eric

thanks :slight_smile: