Swapping all instances of one character within a string with another character
Posted on 2006-04-27
Simple question but I'm struggling to find the answer anywhere.
I'm creating a new directory and want the name of the directory to be the date then time it was created.....taken from a DateTime object. e.g 27 April 2006 12:30:56
However the : in the time is an invalid character for a directory name so what I am doing at the mo is readin the time into a string and I want to swap the : for a valid character, say -.
How do I go about swapping these characters?
I'm open to suggesstions if any1 has a better method.