A Collection of Code Snippets in as Many Programming Languages as Possible
This project is maintained by TheRenegadeCoder
Welcome to the Remove All Whitespace in C# page! Here, you'll find the source code for this program as well as a description of how the program works.
using System;
using System.Linq;
class CSharp
{
public static void ExitWithError()
{
Console.WriteLine("Usage: please provide a string");
Environment.Exit(1);
}
public static void RemoveAllWhitespace(string str) {
Console.WriteLine(
new string(
str
.Where(c => !Char.IsWhiteSpace(c))
.ToArray()
)
);
}
static void Main (string[] args)
{
if (!args.Any() || args[0] == "") {
ExitWithError();
}
RemoveAllWhitespace(args[0]);
}
}
Remove All Whitespace in C# 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.