Linked Questions
21 questions linked to/from Most efficient way to remove special characters from string
-2 votes
3 answers
2k views
Performance & Remove multiple characters from a string in C# [duplicate]
Which is the most performance efficient way to remove multiple characters from a C# string? I have to remove all the spaces, hyphen from a C# string. Thanks
1 vote
1 answer
831 views
Filtering string with Replace & Substring in C# Optimisation [duplicate]
I have created a function to 'filter' a string by removing various characters using the .Replace method, I am also removing anything at the end of the string that starts with '(' using the Substring ...
798 votes
13 answers
558k views
How do I remove all non alphanumeric characters from a string except dash?
How do I remove all non alphanumeric characters from a string except dash and space characters?
48 votes
10 answers
298k views
Remove '\' char from string c#
I have the following code string line = ""; while ((line = stringReader.ReadLine()) != null) { // split the lines for (int c = 0; c < line.Length; c++) { if ( line[c] == ',' &...
34 votes
6 answers
45k views
Keep only numeric value from a string?
I have some strings like this string phoneNumber = "(914) 395-1430"; I would like to strip out the parethenses and the dash, in other word just keep the numeric values. So the output could look like ...
28 votes
13 answers
81k views
Fastest way to remove white spaces in string
I'm trying to fetch multiple email addresses seperated by "," within string from database table, but it's also returning me whitespaces, and I want to remove the whitespace quickly. The following ...
16 votes
7 answers
42k views
C# Remove special characters
I want to remove all special characters from a string. Allowed characters are A-Z (uppercase or lowercase), numbers (0-9), underscore (_), white space ( ), pecentage(%) or the dot sign (.). I have ...
15 votes
9 answers
92k views
How can I check if a string has special characters in C++ effectively?
I am trying to find if there is better way to check if the string has special characters. In my case, anything other than alphanumeric and a '_' is considered a special character. Currently, I have a ...
8 votes
3 answers
6k views
Update with Dapper using dynamic column name
I need to do an update but the column name is dynamic. Code Snippet: using (var cn = Connection) { var sql = @"UPDATE Teste SET @columnName = @parameter, DT_PROCESSAMENTO = @...
0 votes
6 answers
5k views
How can I identify special characters in a string? C#
I'm trying to get all characters in a string that occur before a certain character. For example: string id = "Hello everyone! Good day today."; id = id.Remove(id.IndexOf('!')); Console....
3 votes
3 answers
280 views
Fix string for JavaScript in C#
I have a function that fixed non-printable characters in C# for JavaScript. But it works very slow! How to increase speed of this function? private static string JsStringFixNonPrintable(string Source)...
-2 votes
3 answers
753 views
How can I reverse string which contains spaces and special characters
String reverse which contains spaces and special characters. How can I achieve this without using regex? Input: "M @#.AD()/A?#M" Output :"MADAM"
0 votes
1 answer
1k views
How to convert ASCII symbol such as STX to a BitArray using C#?
I'm new to C#. In a project, I'm dealing with serial communication where I'm trying to send/receive a checksum for verifying data transfer integrity. The device I'm sending messages to accepts ascii ...
-2 votes
2 answers
837 views
Remove characters from a list of strings [duplicate]
I have a list of strings which has got some characters in it. On viewing it in HTML viewer I get the following I tried line.Replace() to remove some special characters but it doesn't work.
2 votes
2 answers
527 views
Unity 5 C# login system - www.data return 1 but it keeps going to else?
So I'm trying to make a simple login system in Unity using C#, PHP and MySQL on localhost, but there is a problem. My code works like this: In the php file, if the username and password matches the ...