hungcoder92

Ling Remove

Apr 16th, 2022
1,133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace remore_characters_from_string
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             string str = "Something @to ,Write.;';";
  12.             str = new string((from c in str
  13.                               where char.IsWhiteSpace(c) || char.IsLetterOrDigit(c)
  14.                               select c
  15.                    ).ToArray());
  16.             Console.WriteLine(str);
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment