Solved

Insert space before each capital letter - should be easy

Posted on 2006-11-28
3
996 Views
Last Modified: 2008-01-09
I have a string in camel case

theDogJumped

and I need to convert it to:

the Dog Jumped

So basically insert a space before each capital letter

I think it should be easy with regular expressions, but the one thing I am not good at is how to use the match in the replacement.
0
Comment
Question by:mrichmon
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 250 total points
ID: 18030722
Hi, try:

      string sample = "theDogJumped";
      sample = Regex.Replace(sample, "(?<cap>[A-Z])", " ${cap}");
0
 
LVL 35

Author Comment

by:mrichmon
ID: 18031571
Perfect Thanks!

Points increased and A awarded!
0
 
LVL 18

Expert Comment

by:Ravi Singh
ID: 18040650
No probs and thanks :)
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Article by: Ivo
Anonymous Types in C# by Ivo Stoykov Anonymous Types are useful when  we do not need to follow usual work-flow -- creating object of some type, assign some read-only values and then doing something with them. Instead we can encapsulate this read…
Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
This video discusses moving either the default database or any database to a new volume.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now