Index: runtime/vm/object.cc |
=================================================================== |
--- runtime/vm/object.cc (revision 5367) |
+++ runtime/vm/object.cc (working copy) |
@@ -7397,6 +7397,23 @@ |
} |
+RawString* String::NewFormatted(const char* format, ...) { |
+ va_list args; |
+ va_start(args, format); |
+ intptr_t len = OS::VSNPrint(NULL, 0, format, args); |
+ va_end(args); |
+ |
+ Zone* zone = Isolate::Current()->current_zone(); |
+ char* buffer = reinterpret_cast<char*>(zone->Allocate(len + 1)); |
+ va_list args2; |
+ va_start(args2, format); |
+ OS::VSNPrint(buffer, (len + 1), format, args2); |
+ va_end(args2); |
+ |
+ return String::New(buffer); |
+} |
+ |
+ |
RawString* String::Concat(const String& str1, |
const String& str2, |
Heap::Space space) { |