Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/302.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 在标签中显示多行文本框文本之间的空格_C#_.net_Html - Fatal编程技术网

C# 在标签中显示多行文本框文本之间的空格

C# 在标签中显示多行文本框文本之间的空格,c#,.net,html,C#,.net,Html,优先输出- Hi Hello U There... 电流输出- Hi Hello U there... 使用带有标记的替换方法仅适用于新行。但是我需要保留U和那里之间的空间 有人能提供解决方案吗?您是否尝试过对每个空间使用?在html中添加 无效的 例如: 沃尔沃汽车 萨博 //隔着 梅赛德斯 奥迪 使用正则表达式添加到@Jon Skeet answer replace空格 string s1 = "He saw a cute\tdog."; Regex r

优先输出-

Hi
Hello
U            There...
电流输出-

Hi Hello U there...
使用带有

标记的替换方法仅适用于新行。但是我需要保留U和那里之间的空间


有人能提供解决方案吗?

您是否尝试过对每个空间使用

在html中添加 无效的 例如:


沃尔沃汽车
萨博
//隔着
梅赛德斯
奥迪

使用正则表达式添加到@Jon Skeet answer replace空格

string s1 = "He saw   a cute\tdog.";
Regex r = new Regex(@"\s+");
string s3 = r.Replace(s1, " ");
输入到texbox text=23
autput to Label=23

@Jon啊,你在编辑方面打败了我!:)@jv42-jon可以击败任何人,因此…………他是fastest@Pranay-我知道我知道,乔恩是如此之快,他在被问之前编辑了问题!;)在编辑问题之前,我得到了答案。有人修改了问题,所以不要对问题提出否定意见。如果不满意,我想你应该这样替换
string s3=r.replace(s1,”
string s1 = "He saw   a cute\tdog.";
Regex r = new Regex(@"\s+");
string s3 = r.Replace(s1, " ");
protected void TextBox1_TextChanged(object sender, EventArgs e)
    {
        string sos = "";
        if (TextBox1.Text == sos)
        {
            TextBox1.Text = "00";
        }
        char opo = TextBox1.Text[0];
        char opo1 = TextBox1.Text[1];
        Label1.Text = (opo + " " + opo1);

    }