primaryOutput method
void
primaryOutput(
- String text
)
Implementation
void primaryOutput(String text) {
var lines = text.split('\n');
for(final l in lines){
var words = Queue<String>.from(l.split(' '));
var s = StringBuffer();
while(words.isNotEmpty){
var nextWord = words.removeFirst();
if (s.length > cols){
stdout.writeln('$s');
s = StringBuffer();
s.write('$nextWord ');
}else{
if (words.isEmpty){
s.write('$nextWord ');
stdout.writeln('$s');
s = StringBuffer();
}else{
s.write('$nextWord ');
}
}
}
if (s.length > 0){
stdout.writeln('$s');
s = StringBuffer();
}
}
}