Question : Split string at capital letters

I have a function which currently splits the country name out like this:

            // delimited string
            string CountryFull = (string)txtValue;
            // separate individual items
            string[] CountrySplit = CountryFull.Split(new char[] { ';' });
            // combine array elements with a new separator
            string CountryDisplay = String.Join("", CountrySplit, 0, 1);
            [insert line in here to add space?]
            return CountryDisplay;

So for 'CountryName;State' it returns 'CountryName'. What I need it to do is return 'Country Name' ie. insert a space before all capital letters after the first capital letter.

Any feedback much appreciated.

Answer : Split string at capital letters

Mmmm... it seems simple. Try this;
1:
2:
3:
4:
5:
6:
7:
string characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for (int k = 0; (k 
            <= (Characters.Length - 1)); k++) {
    string sLetter = characters.Substring(k, 1);
    original_string = original_string.Replace(sLetter, (" " + sLetter));
}
original_string = original_string.Trim();
Random Solutions  
 
programming4us programming4us