Browse Source

added length()

Nicolas Cannasse 19 years ago
parent
commit
9d3a7478b3
1 changed files with 12 additions and 0 deletions
  1. 12 0
      std/StringBuf.hx

+ 12 - 0
std/StringBuf.hx

@@ -80,6 +80,17 @@ class StringBuf {
 		#end
 	}
 
+	public function length() : Int {
+		#if neko
+		return __length(b);
+		#else flash
+		return b.length;
+		#else js
+		return b.length;
+		#else error
+		#end
+	}
+
 	private var b : Dynamic;
 
 #if neko
@@ -88,6 +99,7 @@ class StringBuf {
 	static var __add_char : Dynamic = neko.Lib.load("std","buffer_add_char",2);
 	static var __add_sub : Dynamic = neko.Lib.load("std","buffer_add_sub",4);
 	static var __string : Dynamic = neko.Lib.load("std","buffer_string",1);
+	static var __length = neko.Lib.load("std","buffer_length",1);
 #end
 
 }