Click here to Skip to main content
15,886,049 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
if we give one string that contains 250 characters . i want that to be splited into one string as 160 characters and another string into 90 characters

give give me answer that that question
i want program in c#.net not an explanation
Posted

What have you tried?

This is such a simple and easy task no one should have to be given the answer to it.
 
Share this answer
 
I would seriously recommend that you pick up a book on C# and start reading. It will help you get started with programming.

You will be able to understand the output of such programs then.
 
Share this answer
 
Have you ever done any programming before?

I understand that English may not be your first langauge, but your qustion is just rude.

Do not demand, do not order.

Just ask, and please show what you have done so far and give the context of your requirements.

This really helps.

Mustafa has given a fair answer, try it and see what outputs you get.
 
Share this answer
 
Ashok Kambhampati wrote:
i want program in c#.net not an explanation


Looks like it's your lucky day!

C#
string stringText = "... 250 characters ...";
string subString1 = stringText.Substring(0, 160);
string subString2 = stringText.Substring(160, 90);
 
Share this answer
 
Ashok Kambhampati wrote:
give give me answer that that question
i want program in c#.net not an explanation


That sound's suspiciously like a demand; But I'll give you the benefit of the doubt.

SMS stuff right?

try this:

private string[] StringSplitter(string splitee, int length)
{
	List strings = new List();
	int ubound = (int)Math.Floor(((double)(splitee.Length/length)));
        for(int i = 0; i < ubound; i++)
	{
		strings.Add(splitee.Substring((i*length),length));	
	}
		
	if(splitee.Length > ((ubound-1) * length))
	strings.Add(splitee.Substring(ubound * length));
		
	return strings.ToArray();
}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900