I'm using the regex
System.Text.RegularExpressions.Regex.Replace(stringToSplit, "([A-Z])", " $1").Trim()
to split strings by capital letter, for example:
'MyNameIsSimon' becomes 'My Name Is Simon'
I find this incredibly useful when working with enumerations. What I would like to do is change it slightly so that strings are only split if the next letter is a lowercase letter, for example:
'USAToday' would become 'USA Today'
Can this be done?
EDIT: Thanks to all for responding. I may not have entirely thought this through, in some cases 'A' and 'I' would need to be ignored but this is not possible (at least not in a meaningful way). In my case though the answers below do what I need. Thanks!
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…