Languages
[Edit]
EN

Java - no-break / non-breaking space in string

0 points
Created by:
Lennie-S
439

In this article, we would like to show you how to insert no-break / non-breaking space in string in Java.

Quick solution:

public class Example {

    public static void main(String[] args) throws Exception {
        String text = "a \u00A0\u00A0\u00A0 b"; // U+00A0
        System.out.println(text);  // a     b
    }
}

Output:

a     b

 

Non-breaking space in unicode:

Unicode code
(by hex number)

Java
(by hex number)

HTML
(by dec or hex number)

HTML
(by name)

U+00A0\u00A0 or \u00a0  or   
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

Java - String (popular problems)

Java - no-break / non-breaking space in string
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join