EN
Java - no-break / non-breaking space in string
0 points
In this article, we would like to show you how to insert no-break / non-breaking space in string in Java.
Quick solution:
xxxxxxxxxx
1
public class Example {
2
3
public static void main(String[] args) throws Exception {
4
String text = "a \u00A0\u00A0\u00A0 b"; // U+00A0
5
System.out.println(text); // a b
6
}
7
}
Output:
xxxxxxxxxx
1
a b
Unicode code |
Java |
HTML |
HTML |
U+00A0 | \u00A0 or \u00a0 |   or   | |