Index: sdk/lib/html/html_common/lists.dart |
diff --git a/sdk/lib/html/html_common/lists.dart b/sdk/lib/html/html_common/lists.dart |
index 874039e05c399191c8ad71b4121c87cc844c9217..03cc29e5ccded15e85c4bd2d2a90906cdab186f5 100644 |
--- a/sdk/lib/html/html_common/lists.dart |
+++ b/sdk/lib/html/html_common/lists.dart |
@@ -66,4 +66,22 @@ class Lists { |
} |
return accumulator; |
} |
+ |
+ static String join(List<Object> list, [String separator]) { |
+ if (list.isEmpty) return ""; |
+ if (list.length == 1) return "${list[0]}"; |
+ StringBuffer buffer = new StringBuffer(); |
+ if (separator == null || separator == "") { |
+ for (int i = 0; i < list.length; i++) { |
+ buffer.add("${list[i]}"); |
+ } |
+ } else { |
+ buffer.add("${list[0]}"); |
+ for (int i = 1; i < list.length; i++) { |
+ buffer.add(separator); |
+ buffer.add("${list[i]}"); |
+ } |
+ } |
+ return buffer.toString(); |
+ } |
} |