streamwriter写入文件,但将空格放在第10个字符 [英] streamwriter write to file but put spaces very 10th character

查看:85
本文介绍了streamwriter写入文件,但将空格放在第10个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想在下面编写序列,但每10个字符插入一个空格.我也只想直到100个字符并开始新的一行.该示例如下
有什么建议吗?
在此先感谢


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


MKWVTFISLLLLFSSAYSRGVFRRDTHKSEIAHRFKDLGEEHFKGLVLIAFSQYLQQCPFDEHVKLVNELTEFAKTCVAD
ESHAGCEKSLHTLFGDELCKVASLRETYGDMADCCEKQEPERNECFLSHKDDSPDLPKLKPDPNTLCDEFKADEKKFWGK



MKWVTFISL LLLFSSAYSR GVFRRDTHKS以100个字符返回到下一行



MKWVTFISL LLLFSSAYSR GVFRRDTHKS return at 100 characters to the next line

推荐答案

由于这是家庭作业,因此我不会为您提供代码.
但是,您需要做的是:
1)设置一个计数器以找到您的第100个字符中断,从0开始
2)设置一个循环来处理字符串.
3)使用SubString两次,以将前十个字符删除到流中.
4)如果您已达到第100个字符,请输出新行并重置计数器
否则,输出一个空格.
5)继续循环,直到字符用完.
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.


这篇关于streamwriter写入文件,但将空格放在第10个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆