Test code:
string files = "C:\Hello; C:\Hi; D:\Goodmorning; D:\Goodafternoon; E:\Goodevening";
string[] paths = files.Split(';');
foreach (string s in paths)
{
MessageBox.Show(s);
}
How do I remove the whitespaces before storing it into the array?
You can use
String.Trimmethod, like this:Alternatively, you can eliminate spaces before they enter
paths, like this: