Solved

Manipulating Strings.

Posted on 2004-04-07
2
231 Views
Last Modified: 2010-04-15
For example my String is:

  This is a sample message

 
I want my final stiring to be :

     ThisIsASampleMessage


i need to remove spaces and capitalize the first letter of each word.

any help would be appreciated.  if you can write some code to do this, would be great.

steve.
0
Comment
Question by:steve_mick972
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 2

Accepted Solution

by:
jeffqyzt earned 500 total points
ID: 10777502

         string sIn = "This is a sample message";
         string sOut = string.Empty;

         string[] sArr = sIn.Split(' ');
         
         for (int i = 0 ; i < sArr.Length ; i++)
         {
            sOut += sArr[i].Substring(0,1).ToUpper();
            if (sArr[i].Length > 1)
               sOut += sArr[i].Substring(1, sArr[i].Length -1);                                      
         }
0
 
LVL 2

Expert Comment

by:jeffqyzt
ID: 10778082
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

696 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