To display spaces between the text of a multi-line text field in a shortcut

Preferred Exit -

Hi
Hello
U            There...

Current output -

Hi Hello U there...

Using the tagging method <br/>only works for a new line. However, I need to save the space between U and There.

Can anyone solve this?

+3
source share
4 answers

Have you tried using &nbsp;for each space?

+1
source

Adding an answer to @Jon Skeet, replace the space with & nbsp using a regular expression.

string s1 = "He saw   a cute\tdog.";
Regex r = new Regex(@"\s+");
string s3 = r.Replace(s1, "&nbsp;");
+1
source

In html just add zero for example:

<html>
<body>

<select>
  <optgroup label="Swedish Cars">
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
  </optgroup>
<optgroup >// get a space between 
  <optgroup label="German Cars">
    <option value="mercedes">Mercedes</option>
    <option value="audi">Audi</option>
  </optgroup>
</select>

0
source
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);

    }

text input texbox = 23 autput to Label = 2 3

0
source

All Articles