2 Replies Latest reply on Mar 14, 2011 4:17 AM by huangxinghui

    How can I have replaceAll function ignore case?

    Bhushan Phalak

      In flex and I can't seem to get the replaceAll function for  strings to ignore the case. For example, I have

       

      var str:String =  "This Is a Test string";

      var searchTxt:String = "is";

       

      public  static function StringReplaceAll( source:String, find:String,  replacement:String ) : String

      {
              return source.split( find ).join( replacement );
      }

       

      StringReplaceAll(str,searchTxt,('<b>'+searchTxt+'</b>'));

       

      //Output :This Is a Test string

      //Expected Output : This Is a Test string