Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# string remove special characters

public static string RemoveSpecialCharacters(this string str) {
   StringBuilder sb = new StringBuilder();
   foreach (char c in str) {
      if ((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '.' || c == '_') {
         sb.Append(c);
      }
   }
   return sb.ToString();
}
Comment

c# remove special characters from string

test 
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# size of enum 
Csharp :: How to create connection string dynamically in C# 
Csharp :: convert iformfile to byte array c# 
Csharp :: void ontriggerenter not working 
Csharp :: unity topdown 
Csharp :: how to make a mouse down condition in C# 
Csharp :: cast int to enum type c# 
Csharp :: c# integer to bit string 
Csharp :: how to print hello world in c# 
Csharp :: unity destroy after time 
Csharp :: instantiate list c# 
Csharp :: c# timestamp now 
Csharp :: c# unity detect any keyboard input 
Csharp :: c# list remove item based on property duplicate 
Csharp :: c# string replace comma with newline 
Csharp :: C# Unit test IConfiguration 
Csharp :: unity random number 
Csharp :: C# type cast float to string 
Csharp :: c# string contains any of list 
Csharp :: get folder path winforms 
Csharp :: asp.net c# set session timeout 
Csharp :: how to reference a UI element in unity 
Csharp :: how to pass string value to enum in c# 
Csharp :: function on animation exit unity 
Csharp :: binary search c# 
Csharp :: generate entity model dot net core 
Csharp :: c# best tutorial 
Csharp :: c# isarray 
Csharp :: create new .net project 
Csharp :: convert string to jtoken c# 
ADD CONTENT
Topic
Content
Source link
Name
3+2 =