Solved

Manipulating Strings.

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

770 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