Remove All Whitespace in Dart

Published on 05 October 2025 (Updated: 05 October 2025)

Welcome to the Remove All Whitespace in Dart page! Here, you'll find the source code for this program as well as a description of how the program works.

Current Solution

// Issue 4973
void main(List<String> argv){
  const String error_message = "Usage: please provide a string";
  if (argv.isEmpty || argv[0].isEmpty){
    print(error_message);
    return;
  }
  //Do not convert \r, \n and \t explicitly into carriage return, newline and tab, as per Jeremy inputs
  // Use Regular Expressin to replace carriage return, newline and tab with empty string
  String sentence_no_spaces = argv[0].replaceAll(RegExp(r'[\t\r\n ]'), '');
  print(sentence_no_spaces);
}

Remove All Whitespace in Dart was written by:

If you see anything you'd like to change or update, please consider contributing.

How to Implement the Solution

No 'How to Implement the Solution' section available. Please consider contributing.

How to Run the Solution

No 'How to Run the Solution' section available. Please consider contributing.