public static String formatTextBox(String text, int width, Pattern splitter, Set<String> singleRowers) {
        requireNonNulls(text, splitter);
        requireNonNullElements(singleRowers);

        final StringBuilder sb = new StringBuilder();
        final AtomicInteger col = new AtomicInteger();
        
        splitter.splitAsStream(text)
            .map(w -> w.replace("\t", Formatting.tab()))
            .forEachOrdered(w -> {
                final int wordLen = w.length() - Math.max(w.lastIndexOf('\n'), 0);
                
                if (singleRowers.contains(w)) {
                    sb.append(NL);
                    sb.append(w);
                    sb.append(NL);
                    col.set(0);
                } else {
                    if (col.get() + wordLen >= width) {
                        sb.append(NL);
                        col.set(0);
                    } else if (col.get() > 0) {
                        sb.append(" ");
                        col.incrementAndGet();
                    }
                    sb.append(w);
                    col.getAndAdd(wordLen);
                }
            });
        
        return sb.toString();
    }
Creates and returns a String formatted so it will fit in a box with the
given width. Words in the singleRowers set will appear on a separate
line.

@param text the input text
@param width of the text box
@param splitter pattern to use for splitting up words
@param singleRowers a Set of Strings that shall be on a separate row
@return a String formatted so it will fit in a box with the given width
common-parent/codegen/src/main/java/com/speedment/common/codegen/internal/util/TextUtil.java