Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C# string.split() separate string by uppercase

Tags:

I've been using the Split() method to split strings. But this work if you set some character for condition in string.Split(). Is there any way to split a string when is see Uppercase?

Is it possible to get few words from some not separated string like:

DeleteSensorFromTemplate

And the result string is to be like:

Delete Sensor From Template
like image 510
evelikov92 Avatar asked Mar 22 '16 05:03

evelikov92


1 Answers

Use Regex.split

string[] split =  Regex.Split(str, @"(?<!^)(?=[A-Z])");
like image 68
Avinash Raj Avatar answered Oct 24 '22 07:10

Avinash Raj