Write a C# Sharp program to remove all characters which are non-letters from a given string
- برمجة سي شارب
- برمجة
- 2021-05-15
- MarwaMohammed
الأجوبة
using System;
using System.Text.RegularExpressions;
namespace exercises
{
class Program
{
static void Main(string[] args)
{
string text;
text = "Py@th12on";
Console.WriteLine("Orginal string: "+text);
Console.WriteLine("Remove all characters from the said string which are non-letters: " + test(text));
text = "Python 3.0";
Console.WriteLine("\nOrginal string: " + text);
Console.WriteLine("Remove all characters from the said string which are non-letters: " + test(text));
text = "2^sdfds*^*^jlljdslfnoswje34u230sdfds984";
Console.WriteLine("\nOrginal string: " + text);
Console.WriteLine("Remove all characters from the said string which are non-letters: " + test(text));
}
public static string test(string text)
{
return Regex.Replace(text, @"[^a-zA-Z]", "");
}
}
}
أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال