A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: string trouble

  1. #1
    Banned by GMF ™
    FK´s Banning Machine
    jerez_z's Avatar
    Join Date
    Jun 2001
    Location
    Calgary
    Posts
    235

    string trouble

    I need a good way to isolate the last 4 letters of a string (file extension) any ideas? nothing I try seems to work...

  2. #2
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    this should manage it

    Code:
    tempstr = "testing.swf";
    tempext = tempstr.slice(tempstr.length - 4, tempstr.length);
    trace(tempext); //will give you ".swf"

  3. #3
    Senior Member chi-styler's Avatar
    Join Date
    Jul 2001
    Location
    Bristol, UK
    Posts
    1,237
    or if you're not sure how long the extension is going to be

    Code:
    tempext = tempstr.slice(tempstr.lastIndexOf("."), tempstr.length);

  4. #4
    Banned by GMF ™
    FK´s Banning Machine
    jerez_z's Avatar
    Join Date
    Jun 2001
    Location
    Calgary
    Posts
    235
    thanx alot man I'm goona try that right now

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