Splitting a camel-cased word

This requires a positive lookahead to include the uppercase separators:


using System;
using System.Text.RegularExpressions;
class Program
{
    static void Main(string[] args)
    {

         string r = @"(?=[A-Z])"; 
    
         foreach (string s in Regex.Split ("oneTwoThree", r)) 
            Console.Write (s + " ");         // one Two Three 
    }
}

The output:


one Two Three
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.