ActionScript Search and Replace

Mario Laflamme June 6th, 2006

ActionScript doesn’t provide a built in String.replace() function to search and replace text in a string. Then, here is a small function (but very effective) which is a good alternative.

function replace(search, replace, subject) {
    return subject.split(search).join(replace);
}

Entry Filed under: ActionScript, Flash

Leave a Comment

Required

Required, hidden

Some HTML allowed

Trackback this post  |  Subscribe to the comments via RSS Feed

Schedule

June 2006
M T W T F S S
« May   Jul »
 1234
567891011
12131415161718
19202122232425
2627282930