Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6130951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:55:05+00:00 2026-05-23T16:55:05+00:00

I primarily work with AS3 when dealing with flash, but I have a need

  • 0

I primarily work with AS3 when dealing with flash, but I have a need to use AS2 for a particular project, AS2 is not my friend.

I need to replace a series of substrings within some data on a regular basis. Normally I would create a cleaning function that utilised string.replace() and run my data through it.

However the string.replace() function is missing from AS2 and I haven’t found an equivalent. What would be the simplest method for achieving similar functionality?

example:

dirtydata = "I have ABCtoast withABCABC jamABC"

my result would be:

cleandata = "I have toast with jam" 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:55:05+00:00Added an answer on May 23, 2026 at 4:55 pm

    Do this,

    String.prototype.replace = function(searchStr, replaceStr):String { 
        var arr:Array = this.split(searchStr);
        return arr.join(replaceStr);
    };  
    
    // initial string with a placeholder
    var str:String = 'I have ABCtoast withABCABC jamABC';
    // replace ABC with '' and trace it
    var replacedStr:String = str.replace('ABC','');
    trace(replacedStr)
    

    Else, you could also go for a function performing split and join on the same line.

    function stringReplace(block:String, find:String, replace:String):String
    {
    return str.split(searchStr).join(replaceStr);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi I use AS3 quite a lot for work, but I come from a
We primarily use an ASP.NET environment at work. Right now I'm building an application
I've started work on a project that will be primarily acting as a Sync
My background is primarily as a Java Developer, but lately I have been doing
I use Emacs primarily for coding Python but sometimes I use IDLE. Is there
I work on an open-source Java project, and we have a lot of resource
I'm primarily a server-side developer - not even web server stuff. But I'm finding
I'm trying to find a good work around to not being able to use
I have some experience in developing business logic and database logic and primarily work
Our current project at work is a new MVC web site that will use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.