How to force a new line to keep one line only have 10 characters?

For example, user may input text as below:

AAAAAAAAAABBBBBBBBBBCCCCCCCCCC

But to make it as:

AAAAAAAAAA

BBBBBBBBBB

CCCCCCCCCC

0
aspfun
10/21/2008 6:10:04 PM
asp.net.web-forms 93655 articles. 5 followers. Follow

4 Replies
751 Views

Similar Articles

[PageSpeed] 44

string wholeLine = "AAAAAAAAAABBBBBBBBBBCCCCCCCCCC";
List<string> lines = new List<string>();
while ( wholeline.Length > 0)
{
    if (wholeline.length >= 10)
    {
        lines.Add( wholeline.Substring(0, 10);
        wholeline = wholeline.Substring (10);
    }
    else
    {
        lines.Add(wholeline.Substring(0, wholeline.length);
        break;
    }
}
foreach ( string s in lines)

Console.WriteLine(s);

Nuno Agapito
www.infortucano.pt

Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved.
0
Agapito
10/21/2008 7:09:50 PM

I use string mid function and for loop to make it done.

Thanks

 

0
aspfun
10/23/2008 3:29:13 PM

 Could you explain?

I don't know a string.mid() function...


Nuno Agapito
www.infortucano.pt

Don't forget to click "Mark as Answer" on the post that helped you.
This credits that member, earns you a point and marks your thread as Resolved.
0
Agapito
10/23/2008 4:01:57 PM

 Have a look here, and let me know. If you are stll struggling, I'll send you a real snippet.

http://msdn.microsoft.com/en-us/library/8kyd8789(VS.85).aspx

0
itgirl30
10/23/2008 5:20:09 PM
Reply:

Similar Artilces:

Lines, what lines?
Given all the talk about high voter turnout, I got to the polls about 15 minutes after they opened at 7:15am. This was about the same time I went in 2006. The line today was about the same as then. It took about 30 minutes to vote for McCain and go. By the time I left, the line was about 30% shorter. Weather was good and parking was adequate. Are the reports of long waits just media hype? Don Abel wrote: > Are the reports of long waits just media hype? Maybe you ought to read Kirt's post in the Mark 8:10 blabla thread. Don Abel wrote: > Are the reports of long waits...

Line-To-Line
I have one string like this: Hello, I am a shopkeeper (linefeed) Thus, I like to say... (linefeed) Good Morning (linefeed) How can I put this string line-to-line recording it into a file? How about something like this.... long ln_pos,ln_filenum,ln_start_point string tmp_part ln_start_point = 1 //fileopen ln_filenum = FileOpen("c:\export.txt",LineMode!,Write!,LockWrite!,Replace!) ln_pos = Pos(ls_your_string,'~n',1) //~r~n if CR LF for ln_pos > 0 tmp_part = Mid(ls_your_string,ln_start_point,ln_pos) FileWrite(filenum,tmp_part) ln_start_...

Line by line
Hi, I have a file extremely large in size and length. I want to read the file line by line and worry about matching up each line and running that line through a subroutine instead of opening the entire file (which would take a while). So how do I open a file up and process each line individually? On Dec 17, 2003, at 7:28 PM, PerlDiscuss - Perl Newsgroups and mailing lists wrote: > Hi, I have a file extremely large in size and length. I want to read > the > file line by line and worry about matching up each line and running > that > line through a subroutine i...

Some help is required in converting one line in C# to vb.net. (Line 7)
I have converted the following sample into vb.net except the marked line.  How could you define it in vb.net? Thanks. 1    protected void Page_Load(object sender, EventArgs e)        2    {            ListView lv = new ListView();3                lv.ID = "lv";4                this.form1.Controls.Add(lv);5  &nb...

Strange lines in new web.config (.NET 3.5)?
What do the lines below mean? They appeared in my .NET 2.0->.NET 3.5-project after the conversion. The new .NET 3.5 System.Web.Extensions is referenced to earlier in the assemblies section, so I can't figure out what these lines do? I dont want to remove them, "dependentAssembly" seems important. Does this mean I can't remove my old ASP.NET AJAX assemblies from GAC? Thanks in advance!<runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="System.Web.Extensions&qu...

New Project, loading existing form(s)
I am trying to fix my first ever .Net project by rescuing all the design work I have done on several forms. I start a new Project, copy the aspx, aspx.cs and aspx.resx files to the new projects folder. Then in VS.Net load existing item. But when I compile I get - 'cannot load type' the type being whater the inherits says, eg ProjectName.Webform1 which is in the project. I am beginning to seriously regret moving from Delphi but I guess its just a learning curve - I hope someone can help me understand this error, and either fix it ror advise what I can do to save all my design work. Pat ...

Combine multiple lines into one line
Hi all, I have the file, which looks like: *RECORD* *ID* 001 *TITLE* Here is title number one. *ABSTRACT* First sentence of the abstract. Second sentence of the abstract... Second line of the abstract. *RECORD* *ID* 002 *TITLE* Here is title number one. *ABSTRACT* First sentence of the abstract. Second sentence of the abstract... Second line of the abstract. Is there any simple way to transform this file to look like: *RECORD* *ID* 001 *TITLE* Here is title number one. *ABSTRACT* First sentence of the abstract. Second sentence of the abstract. Second line of the...

Make multiple line into one line
Hi I can a HTML code in string that contains this: <tr class="bgWhite"> <td align="center" width="50"><nobr>OMX &#160;</nobr></td> <td align="center">Q2&#160;2000</td> <td align="center">$ 0.45&#160;</td> <td align="center">$ 0.46&#160;</td> <td align="center">$ 0.52&#160;</td> <td align="center"><nobr>10-Aug-99 BMO</nobr></td> </tr> How do I make it ...

Multi line edit : new line
Hello, We have a multi line edit control which text is set at runtime (text is stored in database). If this text in the database contains "~r~n" then the control does not take a new line but simply displays these characters. However, if I later on concatenate the existing text with the control with the text '~r~ntest', the control does take a new line. mle_text.text=3D mle_text.text + "~r~ntest" How can I set up this control so that it always takes a new line when characters ~r~n are present? Greetings Mich=E8le In a string in PowerScript, a ~...

New Line Character
i using mysql connect to database and found data like "abcde fgh" how to convert this string from two line into one line? and result become "abcdefgh"  hello friend, suppose your string is called myString= "abcde fgh" and then use myString.Replace(System.Enviornment.NewLine,"") hope it helps, Jessica  Jessica CaoSincerely,Microsoft Online Community Support“Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other comm...

new line character
Is there a way to insert a "new line/carriage control" in a varchar column? <Ctrl><Enter> keys work with a text column but just tabs to next control on a varchar column. Tried ~r~n but that just stores/prints the text ~r~n. Seems that <ctrl><enter> used to work in the app. PB 7.02 9028 You can use char(10) + char(13) to get the cr/lf -- Terry Dykstra (TeamSybase) Please state PB / OS / DB versions in your post. MySybase http://my.sybase.com/mysybase Search Deja: http://www.pfcguide.com/_newsgroups/search.asp <Mike> wrote in message...

force a new line
Does anyone know how I can force a new line in the code  with string.format. This is my code qty = string.Format("{0} {1}", row.Cells[3].Text, /n); I am trying to loop through a grid and I want to format this string like Product1 Product2 Product3 I appreciate any advice or if you could tell me a better way to do this.   qty = string.Format("{0} {1}", row.Cells[3].Text, "<br />");"Sector clear"  Wouldn't it be \n?  Or you could use Environment.NewLine.- Clarencewww.ocdprogrammer.comIf a post was helpful to...

New line character
I am writing code (VS2008/C#) that reads text file and passes the file data to SQL Server Procedure. I am reading data of file in StreamReader and passing as Input Parameter to procedure. I need to pass the New Line character also to the procedure. 1. The New Line character can be chr(13) & chr(10) or only chr(10). How to check this in C#?2. How to pass New Line character to SQL Procedure? Thanks    Try using Environment.NewLine Hanan Schwartzberg--------------------http://www.lionsden.co.il Environment.NewLine returns the new line defined in the environment. I nee...

How to force a new line?
I am building a page that is displaying and address that may or may not have all of the fields.  What I am doing is building out a string with line breaks (vbNewLine) and displaying it on my page.  The problem is that it still gets displayed as one big line.  How do I resolve this?  This is my code: strPU = sql_Reader.Item("Company").ToString strPU = strPU & vbNewLine & sql_Reader.Item("PickupAddressLine1").ToString If Len(sql_Reader.Item("PickupAddressLine2").ToString) > 0 Then strPU = strPU & vbNewLine & sql_Reader.Item("PickupAddressLine2").ToStr...

Web resources about - How to force a new line to keep one line only have 10 characters? - asp.net.web-forms

List of Killzone characters - Wikipedia, the free encyclopedia
Cpl. Dante Garza is a loyal, optimistic and likable character- an effective team player. A close companion of Sev, the pair have served together ...

Why Coke Is Sticking With These Giggling Characters For Chinese New Year
... it wanted to find a symbol that would have that same long-term appeal in China, so it went back to the archives. It brought out some characters ...

Digimon World -Next 0rder- Game's Trailer Previews Characters, System
Eir Aoi contributed theme song for game shipping March 17 in Japan

Sina Weibo ends 140-character limit ahead of Twitter
Chinese micro-blogging service Sina Weibo beats its US rival Twitter to ditching a 140-character limit on posts.

Cut ‘Star Wars: The Force Awakens’ scene reveals a new character’s major powers
... one of the many Star Wars movies that will hit cinemas by the end of this decade. One of the best things about the movie was its new characters ...

Black Desert Online gets a second beta and a standalone character creator
... since the first test, will be announced closer to the time. One of the big selling points of Black Desert is its ridiculously detailed character ...

Toyota turned the Prius' parts into anime characters
... car manufacturer, how would you make your technology accessible to the public? Toyota has a rather strange answer: turn it into anime characters. ...

Weibo Beats Twitter To Raising Its 140-Character Limit
The Chinese microblogging service is raising its posting limit to 2,000 characters China's Twitter, Weibo, has beat the original to the punch ...

You Can Now Download Black Desert Online's Famed Character Creator For Free
... made a splash in the video game world not because of particularly impressive gameplay footage, but because of its particularly impressive character ...

Shadowhunters' Only Reasonable Character is Magnus the Snazzy Warlock
... Clary and company making multiple attempts to jog her memories and hopefully get closer to saving her mother and the world. But the only character ...

Resources last updated: 1/22/2016 3:01:25 PM