Quick Alphabet Array

Actionscript:
  1. var alphabet:Array = ("abcdefghijklmnopqrstuvwxyz").split("");
  2. trace("this is the letter b...", alphabet[1]);
  3. trace(alphabet);
  4. /* outputs:
  5. this is the letter b... b
  6. a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
  7. */

This is an easy way to create an array of the alphabet. It's easier to type than:

Actionscript:
  1. var alphabet:Array = ["a","b","c".... etc];

This entry was posted in arrays, string manipulation, strings. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

3 Comments

  1. LazyLady
    Posted November 5, 2008 at 3:43 am | Permalink

    Thanks for a great initiative. Very handy to see your code snippets and easily try them out.

    var alphabet:Array = (”abcdefghijklmnopqrstuvwxyz”).split(”");

    Could be written like this:
    var alphabet:Array = “abcdefghijklmnopqrstuvwxyz”.split(”");
    as long as your not casting.

  2. Posted November 5, 2008 at 7:07 am | Permalink

    Thanks LazyLady. For some reason I didn’t think that would work…. but it does… very cool :)

  3. Posted October 27, 2010 at 3:22 am | Permalink

    Hey thanks,
    exactly the thing i was looking for :)

    greets

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*