char[] delimiterChars = {'*',',', '.', ':', '&','!','@','#','$','%','^','&'};
string text = Console.ReadLine();
System.Console.WriteLine("Original text: '{0}'", text);
string s1=string.Empty;
string[] words = text.Split(delimiterChars);
foreach (string s in words)
{
if (s1 == "")
{
s1 = s;
}
else
{
s1 = s1 + "-" + s;
}
}
s1=s1.TrimEnd('-');
string text = Console.ReadLine();
System.Console.WriteLine("Original text: '{0}'", text);
string s1=string.Empty;
string[] words = text.Split(delimiterChars);
foreach (string s in words)
{
if (s1 == "")
{
s1 = s;
}
else
{
s1 = s1 + "-" + s;
}
}
s1=s1.TrimEnd('-');
No comments:
Post a Comment