Переглянути джерело

[java] Floats to String now don't have a trailing ".0" when they can be represented by an Integer. Fixed Issue #1076

Caue Waneck 13 роки тому
батько
коміт
d70911a914
2 змінених файлів з 9 додано та 1 видалено
  1. 6 1
      std/java/_std/StringBuf.hx
  2. 3 0
      std/java/internal/Runtime.hx

+ 6 - 1
std/java/_std/StringBuf.hx

@@ -33,7 +33,12 @@ class StringBuf {
 	}
 
 	public function add( x : Dynamic ) : Void {
-		b.append(x);
+		if (Std.is(x, Int))
+		{
+			b.append(cast(x, Int));
+		} else {
+			b.append(x);
+		}
 	}
 
 	public function addSub( s : String, pos : Int, ?len : Int ) : Void {

+ 3 - 0
std/java/internal/Runtime.hx

@@ -534,6 +534,9 @@ package java.internal;
 	{
 		if (obj == null)
 			return null;
+		
+		if (isInt(obj))
+			return (cast(obj, Int)) + "";
 		return untyped obj.toString();
 	}
 }