29 June 2010

AS2: Simple, Powerful String Find & Replace all instances function for Flash Actionscript. Similar to PHP's str_replace replacement.

Exactly what it says on the tin!

AS3 version here



Please see right hand panel before copying>

//needle and/or replacement can be either a string or an array of strings:
_global.str_replace=function(needle, replacement, haystack:String) {
 var r=haystack;
 if(typeof(needle)=="string"){
  needle=Array(needle)
 }
 if(typeof(replacement)=="string"){
  replacement=Array(replacement)
  
 }
 while(replacement.length<needle.length){
  replacement.push(replacement[replacement.length-1])
 }
 for(var i in needle){
  r=r.split(needle[i]).join(replacement[i])
 }
 return(r)
}
/*SAMPLE USAGE:
trace( strreplace("A","X","ABCDEFG") )  //outputs: XBCDEF
trace( strreplace(Array("A","B","C"),Array("X","Y","Z"),"ABCDEFG") )  //outputs: XYZDEF
*/

7 comments:

Unknown said...

kd 9 shoes
fitflops
ralph lauren pas cher
ugg boots
longchamp outlet
red bottoms
louboutin uk
rolex watches uk
adidas yeezy
coach factory outlet
20161228caiyan

Unknown said...

20180623xiaoke
polo ralph lauren outlet
air max 2018
cheap jordans
canada goose jackets
coach outlet store online
dsquared2 jeans
cheap jordan shoes
oakley sunglasses wholesale
michael kors outlet clearance
coach outlet store online

Cara Menyembuhkan DBD secara Alami said...

This article is interesting and useful. Thank you for sharing. And let me share an article about health that God willing will be very useful. Thank you :)

Pengobatan Sakit Pinggang secara Cepat & Efektif
Penyebab Sering Nyeri Ulu Hati
Solusi untuk Menanggulangi Osteoporosis
Obat Penyakit Crohn
Vitamin Penguat Tulang dan sendi
Cara Mengobati Abses Payudara Tanpa Operasi

Zihan Amelia said...

Thank you
Your article is very inspirational, hopefully it will be useful for many people

Cara Mengatasi Nyeri Tulang & Sendi
6 Cara Mencegah Dan Mengatasi Pengeroposan Tulang
Cara Menyembuhkan Patah Tulang
Cara Mengempiskan Kaki Bengkak
Obat Kurap

Bongol said...

Disini kami akan berbagi informasi tentang cara menggugurkan hamil dengan cepat dan akurat dengan menggunakan obat aborsi . Mungkin Anda adalah salah satu yang ingin mencari tahu obat penggugur kandungan yang aman dan terbukti ampuh , agar dapat membantu anda untuk melakukan proses cara mencegah kehamilan yang tidak Anda inginkan . Saat ini memang banyak sekali situs yang jual obat aborsi secara online . Namun anda harus lebih cermat dalam memilih . Misoprostol adalah obat menggugurkan kandungan terbaik untuk menginduksi rahim , dan ini bisa anda gunakan untuk memperlancar haid atau sebagai obat telat datang bulan untuk menggugurkan kandungan

Zihan Amelia said...

If love is no longer for me and if he is happy for you, I will leave even though my heart will not be willing

Cara Mengobati Usus Buntu
Cara Mengobati Sinusitis
Cara Mengobati Gusi Bengkak
Cara Menghilangkan Benjolan Di Ketiak
Pengobatan Herbal Alami
Solusi Sehat Dengan Herbal

Anitha said...

This article is really helpful for me. I am regular visitor to this blog. Share such kind of article more in future. Personally i like this article a lot and you can have a look at my services also: I was seriously search for a Salesforce training institutes in ameerpet which offer job assistance and Salesforce training institutes in Hyderabad who are providing certification material. It's worth to join Salesforce training institutes in India because of their real time projects material and 24x7 support from customer desk. You can easily find the best Salesforce training institutes in kukatpally kphb which are also a part of Pega training institutes in hyderabad. This is amazing to join Data science training institutes in ameerpet who are quire popular with Selenium training institutes in ameerpet and trending coureses like Java training institutes in ameerpet and data science related programming coures python training institutes in ameerpet If you want HCM course then this workday training institutes in ameerpet is best for you to get job on workday.

Post a Comment

Cron Design Studio: Dublin based web design & software development