sebako
April 24, 2010, 6:18pm
1
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
dart
April 24, 2010, 6:25pm
2
If you´re using C#, string class has a method that does that. Name is Split.
sebako
April 24, 2010, 6:35pm
3
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