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 :: enum element count C# 
Csharp :: unity keycode for f 
Csharp :: csharp 
Csharp :: List string to file C# 
Csharp :: 2d topdown movement unity 
Csharp :: c# create object with properties 
Csharp :: console.writeline c# 
Csharp :: c# add picturebox to form 
Csharp :: cannot convert from string to type T 
Csharp :: c# minus days from datetime 
Csharp :: c# stop process 
Csharp :: c# indexof 
Csharp :: c# unity detect any keyboard input but not mouse input 
Csharp :: c# print exception stack trace 
Csharp :: implement custom string to datetime convert net core 
Csharp :: blazor swagger setup 
Csharp :: c# find largest number in list 
Csharp :: get description from enum c# 
Csharp :: c# enum to int 
Csharp :: list.max c# 
Csharp :: wpf c# select folder path 
Csharp :: how to make dictionary c# 
Csharp :: Unity Children Destroy 
Csharp :: unity call function on animation end 
Csharp :: increment operator c# 
Csharp :: asp.net core get previouse url 
Csharp :: c# oops concept 
Csharp :: unity rewarded ads 
Csharp :: change color of object unity 
Csharp :: Entity Framework Core 3.1 Return value (int) from stored procedure 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =