Click here to Skip to main content
15,909,325 members
Home / Discussions / C#
   

C#

 
GeneralRe: FOR EXPERTS: Template Class: Type Constraints Pin
Mirko19806-Feb-09 4:26
Mirko19806-Feb-09 4:26 
GeneralRe: FOR EXPERTS: Template Class: Type Constraints Pin
Axonn Echysttas6-Feb-09 5:19
Axonn Echysttas6-Feb-09 5:19 
GeneralRe: FOR EXPERTS: Template Class: Type Constraints Pin
Mirko19806-Feb-09 5:24
Mirko19806-Feb-09 5:24 
Questionconcateing strings in c# Pin
lawrenceinba6-Feb-09 1:32
lawrenceinba6-Feb-09 1:32 
AnswerRe: concateing strings in c# Pin
musefan6-Feb-09 1:38
musefan6-Feb-09 1:38 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 2:57
lawrenceinba6-Feb-09 2:57 
GeneralRe: concateing strings in c# Pin
musefan6-Feb-09 3:15
musefan6-Feb-09 3:15 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 5:51
lawrenceinba6-Feb-09 5:51 
using System;
using System.Collections;

class chapter10 
{
static void Main() 

///<summary>
///Merges any characters on there own
///<summary>
///<param name="s">The string to parse</param>
//string MergeFunction(string s)
{
string result = "s y t y i";
int count= 0;//used to count num of removed chars, this is because length of result may get shorter 
            //than the length of s due to removal of spaces
for(int i = 0; i < result.Length-1; i++)//no need to test last char so use s.length -1 
{
   if(i == 0)//if first char
   {
       if (result[i + 1] == ' ')//check if next char is a space
        {
            result = result.Remove(i+1-count, 1);
            count++;
        }
   }
   else//any char other than the first and last(due to for loop limit)
   {
       if (result[i - 1] == ' ' && result[i + 1] == ' ')//check if both sides of char is a space
        {
            result = result.Remove(i+1-count, 1);
            count++;
        }

   }

}

//return result;

Console.WriteLine( result);
}
}</summary></summary>



this is my modified code.... but it checks only first and second char....wat should i do now.... pls specify changes alone in bold letter...
thanks u very much for ur help

the quieter u become more u hear

GeneralRe: concateing strings in c# Pin
musefan6-Feb-09 6:02
musefan6-Feb-09 6:02 
AnswerRe: concateing strings in c# Pin
Guffa6-Feb-09 5:54
Guffa6-Feb-09 5:54 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 6:35
lawrenceinba6-Feb-09 6:35 
AnswerRe: concateing strings in c# Pin
Guffa6-Feb-09 6:50
Guffa6-Feb-09 6:50 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 7:02
lawrenceinba6-Feb-09 7:02 
GeneralRe: concateing strings in c# Pin
Guffa6-Feb-09 9:00
Guffa6-Feb-09 9:00 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 9:05
lawrenceinba6-Feb-09 9:05 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 9:12
lawrenceinba6-Feb-09 9:12 
GeneralRe: concateing strings in c# Pin
Guffa6-Feb-09 11:17
Guffa6-Feb-09 11:17 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 13:10
lawrenceinba6-Feb-09 13:10 
GeneralRe: concateing strings in c# Pin
lawrenceinba6-Feb-09 9:27
lawrenceinba6-Feb-09 9:27 
QuestionDataAdapter is containing null value Pin
ashish1nov20086-Feb-09 1:08
ashish1nov20086-Feb-09 1:08 
Questionproblem with true type font Pin
prasadbuddhika6-Feb-09 0:53
prasadbuddhika6-Feb-09 0:53 
Questiondata extraction from .mpp file, MS Project not installed. Pin
ajay265816-Feb-09 0:27
ajay265816-Feb-09 0:27 
QuestionSplit CSV Pin
Burim Rama6-Feb-09 0:27
Burim Rama6-Feb-09 0:27 
AnswerRe: Split CSV Pin
musefan6-Feb-09 0:34
musefan6-Feb-09 0:34 
GeneralRe: Split CSV Pin
Burim Rama6-Feb-09 0:36
Burim Rama6-Feb-09 0:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.