arrays arn’t like strings…strings is just a string of caracters all joined to gether, where as an array is an ordered set of alike things like a set of numbers, letters, or values…arrays are easier to refer to a certian entry as well…you just use the myArray*, with strings you would have to chop and change them to get the right thing…
I meant to reply to this yesterday…but my computer was anoying me…hehe oh well
Many of the methods used on strings are very similar to methods used on XML nodes and Array for that matter. (which is why Pom says they are similar to each other.)
i’m gonna have to agree that strings are like arrays, in that they are an array of characters, just with a different syntax than an actual array. see, you can pull just one character from a string, just like you can pull one position and object from an array
It’s not really true. Arrays CAN be like strings and or like XML node trees, but both node trees and array can be so much more. A string can only be a string. The imporant part to a programer is that strings, array and xml nodes can all be manipulated by SOME of the same methods. (at least they seem the same when writing them.)
these all work the same way… using the first object in the hierarchy as the number 0 item and counting up from there. The difference is that you can’t use a ‘split();’ method on an XML tree. Nor can you use ‘childNode’ on anything but an XML tree. So the answer is that they are not the same thing… they just share some common methods.
*Originally posted by sbeener *
**and in the string is like an array debate, i’m firmly in the “not the same thing” camp. **
Ouuhh… That one hurt… Let me explain then: I said that I find arrays [SIZE=1]a bit[/SIZE] similar to strings [SIZE=1]sometimes[/SIZE] because of the .length thing, and because elements of a String can be accessed quite similarly to Arrays elements (in very simple cases). Of course I never said they were the same, but the way I see it, you could use Arrays instead of Strings in most cases (and in C, C++ and Java, Strings are in fact arrays of char if I’m ot mistaken so I don’t how Flash works, but it must be similar).
I knew what you meant anyway… don’t listen to us peanut gallery types. We love you Pom, and you go on thinking that strings and array are whatever they need to be to you, to let you grasp them. I often use associations for things to help me remember how to use them. Rarely do they make sense to anyone other than myself.
Haha, word association is about 95% of the method I have to use to memorize things. No one can understand it, but it works good for me. You could say the word apple and I will remember I have to return a rented movie, I will remember that because there was an apple in the movie or something. Very odd, I don’t even understand it, my brain just works it out on its own.
This thread has been very educational to me. I stood back and learned. I still need to learn more of the basics though. Whenever I seem to run a search for tutorials on strings I get all these entries for learning RegEXP for MX. Is this what I need to know?
And Lost, RegEXP are useful, so you should definitely learn that, but if you want to learn the Strings methods, open the AS dictionary and just try them…
Ahaha! I was waiting for your answer Supra
I agree with you, their are not the same, but what’s a String? An array of char. So let’s settle with this: Strings are a very particular kind of arrays… Or do you disagree?
Ah ha: Supra, this:
‘you can have an array of strings, but can you have an string of arrays?’
is EXACTLY the words i was thinking when i started posting that strings are not like arrays!
And then i thought
var string = “[1,2,3], [4,5,6],[7,8,9]” and so on…
Basically, you can put whatever in a string, cantcha?