deceptikon
Indubitably
Administrator
633 posts since Jan 2012
Reputation Points: 119
Solved Threads: 105
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace LINQTesting
{
class Program
{
static void Main(string[] args)
{
const char UnwantedChar = '.';
string Date = "12.11.1976";
var DateWithout = new char[8];
Console.WriteLine("Original date = {0}",Date);
// Get some help from LINQ
IEnumerable<Char> WithoutTheChar = Date.Where(ch => !ch.Equals(UnwantedChar));
int CharCount = 0;
foreach (char ch in WithoutTheChar) //enumerate
{
DateWithout[CharCount] = ch;
CharCount++;
}
string NewDate = new String(DateWithout);
Console.WriteLine("Date cleaned up = {0}", NewDate);
Console.ReadKey();
}
}
}