标签也应出现在该行的末尾 [英] Tags should also appear at the end of the line
本文介绍了标签也应出现在该行的末尾的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Just need a small help,
Input (textBox1):
<rltocitm2>Section .01. In general
<rltocitm2>Section .02 Letter ruling
<rltocitm2>Section .03 Closing agreement
<rltocitm2>Section .04 Determination letter
<rltocitm2>Section .05 Opinion letter
Output : With a button click
<rltocitm2>Section .01. In general</rltocitm2>
<rltocitm2>Section .02 Letter ruling</rltocitm2>
<rltocitm2>Section .03 Closing agreement</rltocitm2>
<rltocitm2>Section .04 Determination letter</rltocitm2>
<rltocitm2>Section .05 Opinion letter</rltocitm2>
Whichever tag(Highlighted) is starting at the beginning of the line should also appear at the end on the line.
推荐答案
以下代码应该会有所帮助. br/>
following code should help.
string updatedLines;
string[] lines = textbox1.text.Split("\n");
foreach (string line in lines)
{
Console.WriteLine(line);
string updateLine = line + "</" +line.Substring(1,line.IndexOf('>'));
Console.WriteLine(updateLine);
updatedLines += updateLine;
}
现在,updatedLines变量将成为您所需的字符串.
这将认为您的文本位于.text文件中,然后进行阅读.您可以适当地替换它.
希望能有所帮助.如果确实将答案标记为解决方案和/或赞成.
谢谢
Milind
Now updatedLines variable will be your required string.
This considers your text is in a .text file and then reading it. You can replace it appropriately.
Hope that helps. If it does mark the answer as solution and/or upvote.
Thanks
Milind
将输入读取为字符串
Read the input into a string
string input;
string output="";
string temp1="";
string temp2="";
temp1=input.subString(0,input.indexOf('>'));
temp2[0]=temp1[0];
temp2[0]='/';
for(int i=1;i<temp1.count;i++)>
temp2[i+1]=temp1[i];
output=input+temp2;
我为一个字符串编写了代码,您可以通过将输入放入字符串数组,并对所有输入字符串执行相同的操作,并使用foreach或for循环对所有字符串应用相同的过程.
I wrote code for one string u can do the same for all the input strings by taking the input into a string array and apply the same procedure for all the strings using a foreach or a for loop.
这篇关于标签也应出现在该行的末尾的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文