4 Replies Latest reply on Nov 25, 2011 8:40 PM by Flex harUI

    How to replace a big String?

    DuoMi

      I have a big String,

       

      I want to replace all "\r\n" in the String.

       

      my code:

       

       

      public static function replaceStr(str:String,fromStr:String,toStr:String):String

        {

         while(str.indexOf(fromStr)>-1)

         {

          str=str.replace(fromStr,toStr);

         }

         return str;

        }

       

      str=replaceStr(bigStr,"\r\n","");

       

       

      as a result:Error #1502: A script has executed for longer than the default timeout period ...

       

      I think there is so many many "\r\n"

       

      so how can i replace so many "\r\n"  in the big String?