Linked Questions
10 questions linked to/from Fastest way to remove white spaces in string
24 votes
3 answers
53k views
How to remove spaces and newlines in a string [duplicate]
sorry if they are not very practical for C # Asp.Net, I hope to make me understand I have this situation string content = ClearHTMLTags(HttpUtility.HtmlDecode(e.Body)); content=content.Replace("\r\n",...
-3 votes
1 answer
129 views
How to remove space in String [duplicate]
String prod="pizza cafe",i want to print "PizzaCafe" .How to do that in Asp.net?i want to minimize space between pizza and cafe? String abc=TextBox1.Text; if TextBox1.Text="pizza cafe",i want to ...
327 votes
31 answers
629k views
Most efficient way to remove special characters from string
I want to remove all special characters from a string. Allowed characters are A-Z (uppercase or lowercase), numbers (0-9), underscore (_), or the dot sign (.). I have the following, it works but I ...
44 votes
9 answers
139k views
How to remove leading and trailing spaces from a string
I have the following input: string txt = " i am a string " I want to remove space from start of starting and end from a string. The result should ...
25 votes
7 answers
12k views
Fastest way to remove chars from string
I have a string from which I have to remove following char: '\r', '\n', and '\t'. I have tried three different ways of removing these char and benchmarked them so I can get the fastest solution. ...
-2 votes
4 answers
3k views
Removing multiple whitespace, c# [duplicate]
what I'm trying to do is I'm trying to reduce whitespace sizes to 1 characters (removing any unneeded whitespace. How should I deal with the task ? PS.: NO Regex EDIT.: Thanks, already succeeded, ...
0 votes
2 answers
4k views
How to remove white spaces from sentence?
I want to remove all white spaces from string variable which contains a sentence. Here is my code: string s = "This text contains white spaces"; string ns = s.Trim(); Variable "sn" should look like "...
3 votes
2 answers
804 views
C# - Removing white space between characters using the usual techniques don't work
I've got a problem which seems to be a real nut. I am using HTMLAgilityPack in order to read in an HTML page and use XPath to select a couple of elements I need. This works fine. Using XPATH, I'm ...
0 votes
1 answer
992 views
How do I copy an excel range to Text (.txt) file, unformatted so that all cells form one single string and are not separate items? C#
I get a range of all "Good" cells in Column B of my excel sheet, the find the corresponding cells in the "D" Column and create a range of those cells. I want to convert all those cells to one single ...
0 votes
2 answers
1k views
C# Recommended way of performing a custom encoding of a string
So, my question is fairly simple. I have a string and I want to be able to use it in urls. Simple, right? The tricky part is, however, I want a custom way of encoding it. You see, my language is full ...