All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
PHP编程中操作目录和文件总结_[PHP教程]
让Apache支持ASP.NET-Apache,ASP.NET_.net资料_编程技术
通过对PHP服务器端特性的配置加强PHP的安全_php资料_编程技术
ASP.NET服务器控件编程之卷首语_[Asp.Net教程]
ASP.NET(C#)生成静态html页面_[Asp.Net教程]
md5加密代码示例_[Asp.Net教程]
HTML-加速、再加速_[Html教程]
C#,3.0新特性初步研究,Part5:匿名类型_[Asp.Net教程]
PHP的十个高级技巧(上)_[PHP教程]
C#将指定网页添加到收藏夹的方法_[Asp.Net教程]
Reading number is top 10 pictures
The money of more than 100 countries and regions22
漂亮的跳舞妹妹1
Sora aoi be huged like a bear
原子弹轰炸长崎的珍贵照片
Ashlynn Brooke photograph of a group2
红楼梦金陵十二钗(2)
Female model behind the bitterness, often being overcharged1
Forced sex girl living abroad2
The household design, do not do bridal chamber a pity
全身蕾丝丝质美臀
Download software ranking
美女写真2
Tram sex maniac 2 (H) rar bag1
Boxer's Top ten classic battle5
Wild things 2
Tram sex maniac 2 (H) rar bag12
Tram sex maniac 2 (H) rar bag15
Tram sex maniac 2 (H) rar bag16
Unix video tutorial17
Unix video tutorial14
Unix video tutorial3
delv published in(发表于) 2014/1/6 9:08:32 Edit(编辑)
[C#]StringWriter实现的一个功能_[Asp.Net教程]

[C#]StringWriter实现的一个功能_[Asp.Net教程]

[C#]StringWriter实现的一个功能_[Asp.Net教程]

如何用一组双倍间距的句子创建一个连续的段落,然后将该段落重新转换为原来的文本:


using System;
using System.IO;


class StringRW
{
static void Main()
{
string textReaderText = "TextReader is the abstract base " +
"class of StreamReader and StringReader, which read " +
"characters from streams and strings, respectively.\n\n" +


"Create an instance of TextReader to open a text file " +
"for reading a specified range of characters, or to " +
"create a reader based on an existing stream.\n\n" +


"You can also use an instance of TextReader to read " +
"text from a custom backing store using the same " +
"APIs you would use for a string or a stream.\n\n";


Console.WriteLine("Original text:\n\n{0}", textReaderText);
string aLine, aParagraph = null;
StringReader strReader = new StringReader(textReaderText);
while(true)
{
aLine = strReader.ReadLine();
if(aLine != null)
{
aParagraph = aParagraph + aLine + " ";
}
else
{
aParagraph = aParagraph + "\n";
break;
}
}
Console.WriteLine("Modified text:\n\n{0}", aParagraph);
int intCharacter;
char convertedCharacter;
StringWriter strWriter = new StringWriter();
strReader = new StringReader(aParagraph);
while(true)
{
intCharacter = strReader.Read();
if(intCharacter == -1) break;
convertedCharacter = Convert.ToChar(intCharacter);
if(convertedCharacter == '.')
{
strWriter.Write(".\n\n");
strReader.Read();
strReader.Read();
}
else
{
strWriter.Write(convertedCharacter);
}
}
Console.WriteLine("\nOriginal text:\n\n{0}",
strWriter.ToString());
}
}


来源:网络







添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.