Click here to Skip to main content
15,888,002 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,
I would like to write the sequence below but put in a space every 10th character. I would also like to only go until 100 characters and start a new line. The example is below
Any suggestions?
Thanks in advance


VB
MKWVTFISLLLLFSSAYSRGVFRRDTHKSEIAHRFKDLGEEHFKGLVLIAFSQYLQQCPFDEHVKLVNELTEFAKTCVAD
ESHAGCEKSLHTLFGDELCKVASLRETYGDMADCCEKQEPERNECFLSHKDDSPDLPKLKPDPNTLCDEFKADEKKFWGK


MKWVTFISL LLLFSSAYSR GVFRRDTHKS return at 100 characters to the next line
Posted
Comments
Sergey Alexandrovich Kryukov 5-Jun-11 13:37pm    
School assignment. Who will be interested to solve this boring problem for you? It's trivial: try to do it by yourself and ask a question if you face any problem. This is the way CodeProject really helps, not the other way around.
--SA

1 solution

Since this is homework, I am not going to give you code.
However, what you need to do is:
1) Set up a counter to find your 100th character break, start with 0
2) Set up a loop to process the string.
3) Use SubString twice to remove the first ten characters into the stream.
4) If you have reached the 100th character, output a new line and reset your counter
Otherwise, output a space.
5) Continue the loop until you run out of characters.
 
Share this answer
 

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