EN
C# / .NET - convert space into non breaking space
0
points
In this article, we would like to show you how to convert space into non-breaking space in C#.
Quick solution:
string text = "A B C";
string result = text.Replace(" ", "\u00A0");
Practical example
In this example, we replace all spaces in the text to non-breaking spaces (\u00A0 unicode) using Replace() method.
using System;
public class TestClass
{
public static void Main()
{
string text = "A B C";
string result = text.Replace(" ", "\u00A0");
Console.WriteLine(result);
}
}
Output:
A B C