Solved

Manipulating Strings.

Posted on 2004-04-07
2
226 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
Comment Utility

         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
Comment Utility
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Query datatable in LINQ 6 39
Mutually exclusive checkbox in a gridview 18 40
Long URL in SMS 6 21
VB.NET HttpWebRequest 12 30
Extention Methods in C# 3.0 by Ivo Stoykov C# 3.0 offers extension methods. They allow extending existing classes without changing the class's source code or relying on inheritance. These are static methods invoked as instance method. This…
Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

762 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

11 Experts available now in Live!

Get 1:1 Help Now