A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Longest Word in Dart page! Here, you'll find the source code for this program as well as a description of how the program works.
//Issue 4972
void main(List<String> argv){
const String error_message = "Usage: please provide a string";
if (argv.isEmpty || argv[0].isEmpty){
print(error_message);
return;
}
String sentence = argv[0];
String raw = sentence.replaceAll(r'\t', '\t').replaceAll(r'\r', '\r').replaceAll(r'\n', '\n');
List<String> words = raw.split(RegExp(r'\s+'));
int max_length= 0;
for (String each_word in words){
if (each_word.length > max_length){
max_length = each_word.length;
}
}
print(max_length);
}
Longest Word in Dart was written by:
If you see anything you'd like to change or update, please consider contributing.
No 'How to Implement the Solution' section available. Please consider contributing.
No 'How to Run the Solution' section available. Please consider contributing.