|
-
Split string into an array
I want to split a string into an array, for example :
aString="a b c d";
The result should be an array :
a[1] = "a"
a[2] = "b"
a[3] = "c"
a[4] = "d"
Anyone know how to do this using actionscript ?
-
Senior Member
ok
Code:
a = aString.split(" ")
will work for you.
BUT
arrays start at 0, not 1
so you will in fact get:
a[0] = "a"
a[1] = "b"
a[2] = "c"
a[3] = "d"
-
Hello,
Would you know how to split this kind of array?
var xmlTournamentStartDate:Array = "2013-06-10 15:20:01";
tmp = xmlTournamentStartDate.split("-");
tmp2 = xmlTournamentStartDate.split(":");
I need to split all the numbers to be able to use them around as i need, the final format of this would be :
10 JUNE * 15h20 (french format)
I know how to make a function that replaces number by a month but i'm a bit stuck on the split function... maybe we can't split this kind of format?
Thanks!
-
 Originally Posted by rolandla
Hello,
Would you know how to split this kind of array?
var xmlTournamentStartDate:Array = "2013-06-10 15:20:01";
tmp = xmlTournamentStartDate.split("-");
tmp2 = xmlTournamentStartDate.split(":");
I need to split all the numbers to be able to use them around as i need, the final format of this would be :
10 JUNE * 15h20 (french format)
Thanks!
This is probably a little late, but as I was passing:
var str:String="2013-06-10 15:20:01"
var tempArr:Array=str.split("-")
var tempArr2:Array=tempArr[2].split(":")
var newStr:String=tempArr[0]+" JUNE * "+tempArr2[0]+"h"+tempArr2[1];
trace(newStr)//2013 JUNE * 10 15h20
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|