文本/单词的某些部分在新行上? [英] Some part of text/word goes on new line?

查看:88
本文介绍了文本/单词的某些部分在新行上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好先生,

我正在尝试使用文本行,该行的某些部分出现在新行上。它可以吗?



例如

这是我的输入行: -

Hello Sir,
I'm Trying in text line some part of that line come on the new line.It can be possible?

e.g.
that's my input line:-

FORM OF APPLICATION FOR PURCHASE OF KISAN VIKAS PATRA (BY INVESTMENT THROUGH AGENTS) Serial No……………………



我希望输出如下: -


I want the output as follows:-

FORM OF APPLICATION FOR PURCHASE OF KISAN VIKAS PATRA (BY INVESTMENT THROUGH AGENTS)
Serial No……………………



序列号.................. ......子字符串出现在新行..

如何?


Serial No…………………… sub string come on new line..
How?

推荐答案

试试这个..



Try this..

string  oldString = "FORM OF APPLICATION FOR PURCHASE OF KISAN VIKAS PATRA (BY INVESTMENT THROUGH AGENTS) Serial No……………………";
string newString = oldString.Replace(")", ")\n");









or

string text = "FORM OF APPLICATION FOR PURCHASE OF KISAN VIKAS PATRA (BY INVESTMENT THROUGH AGENTS) Serial No……………………";
text = text.Replace(")", ")" + System.Environment.NewLine);


请请参阅解决方案1,但是......



这些新行取决于您想要输出的位置。最常见的是,ASP.NET生成HTML,然后行尾应为< br />



此外,如果您为新行编写 System.Environment.NewLine 会发生什么?这是为代码运行的系统获取新行的绝对正确方法。对于ASP.NET,这是运行HTTP服务器(服务器端主机)的主机的平台。如果结果传递给某个客户端,结果取决于客户端的平台和软件。即使这些天终端问题得到了大规模解决,但这种平台差异仍然存在,作为人类短视,顽固和不良协作技能的纪念碑。请参阅:

http://en.wikipedia.org/wiki/Newline [< a href =http://en.wikipedia.org/wiki/Newlinetarget =_ blanktitle =New Window> ^ ]。



-SA
Please see Solution 1, but…

Those new lines depend on where you want to output it. Most usually, ASP.NET generates HTML, then the end-of-line should be <br/>.

Besides, what happens if you write System.Environment.NewLine for new line? This is the absolutely correct way to get new line for… the system where the code is running. In case of ASP.NET, this is the platform of the host running the HTTP server, server-side host. If the result is delivered to some client, the result depends on the client's platform and software. Even though these days the end-of-line problem is massively solved, this platform difference remains, as a monument if humans' short vision, stubbornness and poor collaborative skills. Please see:
http://en.wikipedia.org/wiki/Newline[^].

—SA


// yourText contains your text data
yourText = yourText.Replace("\r\n", "<br />");


这篇关于文本/单词的某些部分在新行上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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