join method
- [String separator = ""]
Converts each element to a String and concatenates the strings.
Iterates through elements of this iterable, converts each one to a String by calling Object.toString, and then concatenates the strings, with the separator
string interleaved between the elements.
Implementation
String join([String separator = ""]) { Iterator<E> iterator = this.iterator; if (!iterator.moveNext()) return ""; StringBuffer buffer = StringBuffer(); if (separator == null || separator == "") { do { buffer.write(iterator.current.toString()); } while (iterator.moveNext()); } else { buffer.write(iterator.current.toString()); while (iterator.moveNext()) { buffer.write(separator); buffer.write(iterator.current.toString()); } } return buffer.toString(); }
© 2012 the Dart project authors
Licensed under the Creative Commons Attribution-ShareAlike License v4.0.
https://api.dart.dev/stable/2.13.0/dart-core/Iterable/join.html