String Search and Replace

/ Published in: ActionScript
Save to your folder(s)

Provides a quick and simple "find this string pattern and replace it with this other string pattern" find and replace. Not fancy enough for regular expressions, but untill AS3 is standard this works well for most search/replace needs.

Can be very handy for processing incoming text, whether via user input or from a database or otherwise. For instance, searching for "\r" and replacing with "\n" or "" to control how line breaks flow.

Copy this code and paste it in your HTML
  1. myString.split("foo").join("bar");

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.