Browse Source

optional len for addSub.

Nicolas Cannasse 19 years ago
parent
commit
947628dc29
1 changed files with 6 additions and 1 deletions
  1. 6 1
      std/StringBuf.hx

+ 6 - 1
std/StringBuf.hx

@@ -60,9 +60,14 @@ class StringBuf {
 	/**
 		Adds a part of a string to the string buffer.
 	**/
-	public function addSub( s : String, pos : Int, len : Int ) {
+	public function addSub( s : String, pos : Int, ?len : Int ) {
 		#if neko
 		__add_sub(b,untyped s.__s,pos,len);
+		#else flash9
+		if( len == null )
+			b += s.substr(pos);
+		else
+			b += s.substr(pos,len);
 		#else flash
 		b += s.substr(pos,len);
 		#else js