Please check the code for splitting a string into 3 msgs

Mar 17 2014 6:58 AM
Please check th e following code
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SentencePrograms
{
class DividName
{
public void SplitString(string name,out string first,out string second)
{
int e=name.LastIndexOf(' ');
first = name.Substring(0, e);
second = name.Substring(e + 1);
}
}

class OutModifierDemo
{
static void Main(string[] args)
{
string message, first, second, mSplit;

DividName divName = new DividName();

Console.WriteLine("Enter any message");
message=Console.ReadLine();

mSplit = divName.SplitString(message, out first, out second);
Console.WriteLine(mSplit);
Console.WriteLine(first);
Console.WriteLine(second);
}
}
}


Answers (1)