8+ C Sharp Blank Space Remover Programs

This post contains a total of 8+ C Sharp Blank Space Remover Program Examples with Source Code. All these Blank Space Remover Programs are used to remove Blank / White Space from Strings, and these programs are made using C Sharp.

You can use the source code of these examples with credits to the original owner.

Related Posts

C Sharp Blank Space Remover Programs

1. By STN

Made by STN. A Basic C# Program to remove white space from a text string. Source

qw wq we we
qwwqwewe
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            
            str = str.Replace(" ", "");
            Console.Write(str);
        }
    }
}

2. By Uni

Made by Uni. Program to remove string spaces and return output without spaces. Source

You entered asd fgh jkl and now it is: asdfghjkl.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn{

    class Program{
    
        static void Main(string[] args){
            var n=Convert.ToString(Console.ReadLine());
            Console.WriteLine("You entered {0} and now it is: {1} .",n,n.Replace(" ",""));
        }
    }
}

3. By Mario ChalΓ©n

Made by Mario ChalΓ©n. Program to remove blank spaces from string that contains both numbers and alphabets. Source

The text you provided was: qw er ty
The text without spaces is: qwerty
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to my entry for the \"Remove Spaces from a String\" Challenge!");
            Console.WriteLine("");
            
            string Input = Console.ReadLine();
            
            if (Input != ""){
                string Output = Input.Replace(" ", "");
            
                Console.WriteLine("The text you provided was: {0}", Input);
                Console.WriteLine("The text without spaces is: {0}", Output);
            }
            
            else {
                Console.WriteLine("You have not provided any text.");
            }
            
            Console.Write("Thanks for using this code. Leave a like!");
        }
    }
}

4. By Donkl

Made by DonkI. Very small program to remove spaces from a string. Source

test test
testtest
using System;

namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write(Console.ReadLine().Replace(" ",""));
        }
    }
}

5. By zeravan

Made by zeravan. Source

qw er
qwer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            
            string a=Console.ReadLine();
            Console.WriteLine(a);
            string r="";
            for(int i = 0;i < a.Length;i++)
            {
                if((int )a[i]!=(int )' ')
                {
                    r += a[i];
                }
            }
            Console .WriteLine (r);
        }
        
        
    }
}

6. By Muhammad Abu Baker

Made by Muhammad Abu Baker. Source

we re
were
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
           string before= Console.ReadLine();
 		string after="";
 		for(int i=0;i<before.Length;i++)
 		{
 			if(before[i]!=' ') after+=before [i];
 		}
 		Console.WriteLine(after);
        }
    }
}

7. By Kaveman

Made by Kaveman. Source

as df gh
asdfgh
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            string _input = Console.ReadLine();
            while (_input.Contains(" "))
                _input = _input.Replace(" ", "");
            Console.WriteLine(_input);
        }
    }
}

8. By Mahmoud Ennami

Made by Mahmoud Ennami. Basic Empty Space Remover Program. Source

Input: zx xc cv vb
Output: zxxccvvb
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            string someString = Console.ReadLine();
            string newString = "";
            foreach (char ch in someString) {
                if (ch == ' ')
                    continue;
                else
                    newString += ch;
                
            }
            
            Console.Write("Input: " + someString + "\n" + "Output: " + newString);
        }
    }
}

9. By Caylow

Made by Caylow. Source

Input string: lo um
loum
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace SoloLearn
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Input string:"); string[] textnospaces = Console.ReadLine().Split(' ');
            foreach(string x in textnospaces) Console.Write(x);    
        }
    }
}