i need to parse some data and i want to convert
AutomaticTrackingSystem
to
Automatic Tracking System
esse
Without regex you can do something like (or perhaps something more concise using LINQ):
(Note: no error checking is there, you should add it)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SO
{
class Program
{
static void Main(string[] args)
{
String test = "AStringInCamelCase";
StringBuilder sb = new StringBuilder();
foreach (char c in test)
{
if (Char.IsUpper(c))
{
sb.Append(" ");
}
sb.Append(c);
}
if (test != null && test.Length > 0 && Char.IsUpper(test[0]))
{
sb.Remove(0, 1);
}
String result = sb.ToString();
Console.WriteLine(result);
}
}
}
this gives the output
A String In Camel Case