Solved

Manipulating Strings.

Posted on 2004-04-07
2
230 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

In order to hide the "ugly" records selectors (triangles) in the rowheaders, here are some suggestions. Microsoft doesn't have a direct method/property to do it. You can only hide the rowheader column. First solution, the easy way The first sol…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

734 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