flex中的创建StringBuffer

import mx.collections.ArrayCollection;
 
 public class StringBuffer
 {
 
  public function StringBuffer()
  {
  }     
     /**
     * @private
     * */
     private var source:ArrayCollection=new ArrayCollection();
    
  public function get data():ArrayCollection
  {
   return source;
  }
  
  /**
     * @private
     * */
  public function set data(value:ArrayCollection):void
  {
   source.removeAll();
   source=value;
  }
      /**
     * @private
     * */
  public function append(s:String):StringBuffer
  {
   source.addItem(s);
   return this;
  }
  
  /**
     * @private
     * */
  public function insert(i:int,s:String):StringBuffer
  {
   source.addItemAt(s,i);
   return this;
  }
  
  /**
     * @private
     * */
  public function remove(i:int):StringBuffer
  {
   source.removeItemAt(i);
   return this;
  }
  
  /**
     * @private
     * */
  public function clear():void
  {
   source.removeAll();
  }
  
  /**
     * @private
     * */
  public function toString():String
  {
   var result:String="";
   for each(var s:String in source)
    result+=s+"\n";
   return result;
  }
  
 }

你可能感兴趣的:(Flex)