A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] Delete the first character in an item in an array

  1. #1
    Junior Member
    Join Date
    Mar 2010
    Posts
    16

    resolved [RESOLVED] Delete the first character in an item in an array

    How would I go about removing only the first character of an item in an array? All my items are strings, so for example I want to turn this:

    pseudo code:

    Array["01234","01234"]

    to this:

    Array["1234","1234"]

    Or if that isn't possible, I could just turn each element into a string, modify it and re-Array it. The issue is using split(charAt(0)) isn't correct syntax. I just don't know what function to call and every search turns up only replacing specific characters, not character at a position.
    Last edited by Rajada; 04-20-2011 at 10:12 PM.

  2. #2
    Will moderate for beer
    Join Date
    Apr 2007
    Location
    Austin, TX
    Posts
    6,801
    Actionscript strings are immutable, which means that they cannot be changed in place. But you can replace the String in the array.

    To get the substring of a String which is everything except the first letter, do:
    Code:
    var yString:String = myString.substring(1);

  3. #3
    Junior Member
    Join Date
    Mar 2010
    Posts
    16
    Okay, that works, thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center