Wrap the specified text.

@param text the text to wrap.
@return the wrapped text.
13320
public String wrap(String text) {
        StringBuilder sb = new StringBuilder();
        int continuationLength = continuation.length();
        int currentPosition = 0;

        for (String word : text.split(" ")) {
            String lastWord;
            int wordLength = word.length();

            if (currentPosition + wordLength <= width) {
                if (currentPosition != 0) {
                    sb.append(" ");
                    currentPosition += 1;
                }

                sb.append(lastWord = word);
                currentPosition += wordLength;
            } else {
                if (currentPosition > 0) {
                    sb.append(LINE_SEPARATOR);
                    currentPosition = 0;
                }

                if (wordLength > width && strict) {
                    int i = 0;
                    while (i + width < wordLength) {
                        sb.append(word.substring(i, width - continuationLength)).append(continuation)
                                .append(LINE_SEPARATOR);
                        i += width - continuationLength;
                    }
                    String endOfWord = word.substring(i);
                    sb.append(lastWord = endOfWord);
                    currentPosition = endOfWord.length();
                } else {
                    sb.append(lastWord = word);
                    currentPosition += wordLength;
                }
            }

            int lastNewLine = lastWord.lastIndexOf("\n");
            if (lastNewLine != -1) {
                currentPosition = lastWord.length() - lastNewLine;
            }
        }

        return sb.toString();
    }
1063836
public void fromText(String text) {
        String str;
        Occurrence occ;
        List<Term> terms = new ArrayList<Term>();
        StringBuilder sb = new StringBuilder();
        for (List<Term> sentence : seg2sentence(text)) {
            totalTerm += sentence.size();

            // 产生ngram, 总串长度不超过length
            for (int i = 0, j, len = sentence.size(); i < len; ++i) {
                for (j = i; j < len; ++j) {
                    str = sentence.get(j).getRealName();
                    if (termMap.containsKey(str)) {
                        termMap.put(str, termMap.get(str) + 1);
                    } else {
                        addTerm(str);
                    }

                    sb.append(str);
                    if (length < sb.length()) {
                        break;
                    }

                    terms.add(sentence.get(j));

                    str = sb.toString();
                    occ = occurrenceMap.containsKey(str) ? occurrenceMap.get(str) : new Occurrence(new ArrayList<Term>(terms));

                    // 添加左邻项
                    if (0 < i) {
                        occ.addLeftTerm(sentence.get(i - 1).getRealName());
                    }

                    // 添加右临项
                    if (j < len - 1) {
                        occ.addRightTerm(sentence.get(j + 1).getRealName());
                    }

                    // 递增出现频次
                    occ.increaseFrequency();

                    //
                    if (occ.getFrequency() == 1) {
                        addOccurrence(str, occ);
                    }
                }

                //
                terms.clear();
                sb.delete(0, sb.length());
            }
        }
    }
416261
public Option title(String text, String subtext) {
        this.title().text(text).subtext(subtext);
        return this;
    }
422064
public SelectStep text(String text) {
		return new SelectStep(element, text, SelectStep.OptionSelectorType.TEXT);
	}
248109
private static String buildText(String text) {
    // <JAR><JAR> to PARAGRAPH mark in unicode
    text = doubleLineBreak.matcher(text).replaceAll(PARAGRAPH);
    // <JAR> to " "
    text = lineBreak.matcher(text).replaceAll(" ");
    return text;
  }
1358365
public TextMatchBinding setText(
                    final Collection<String> text
                    )
    {
        if (text == null  ||  text.size() == 0) {
            clearText();
            return this;
        }

        synchronized (text) {
            for (String  pattern : text) {
                if (pattern == null  ||  pattern.length() == 0) {
                    throw new IllegalArgumentException( "null element" );
                }
            }

            clearText();
            for (String  pattern : text) {
                addText( pattern );
            }
        }

        return this;
    }
398236
public static String makeParagraphs (String text)
    {
        if (text == null) {
            return text;
        }
        // handle both line ending formats
        text = text.replace("\n\n", "\n<p>\n");
        text = text.replace("\r\n\r\n", "\r\n<p>\r\n");
        return text;
    }
992382
public OptionBuilder withDescription( String text )
    {
        if (option.getDescription() != null) throw new IllegalArgumentException( "Description given twice" );
        option.setDescription( text );
        return this;
    }
541425
public HintText withText(String text)
    {
        Hint hint = new Hint();
        hint.setTitle(title);
        hint.setText(text);
        return hint;
    }
1229972
protected Label createLabel(String text) {

        Label label = new Label(text);
        Style style = label.getElement().getStyle();
        style.setMarginTop(10, Unit.PX);
        style.setMarginBottom(4, Unit.PX);
        style.setFontWeight(FontWeight.BOLD);
        return label;
    }
530824
public static String asTitleCase(String text) {
        StringBuilder sb = new StringBuilder();
        boolean next = true;

        for (char c : text.toCharArray()) {
            if (Character.isSpaceChar(c)) {
                next = true;
            } else if (next) {
                c = Character.toTitleCase(c);
                next = false;
            }
            sb.append(c);
        }

        return sb.toString();
    }
226619
public String replace(CharSequence text)
    {
        StringBuilder sb = new StringBuilder();
        replace(sb, text);
        return sb.toString();
    }
1011297
public static String[] simpleTokenize(String text) {
		if (GeneralUtils.isEmpty(text))
			return null;
		return text.split("[ ,.;:><^`�\\]\\[}{|��+_)(*&�%$#@!=\\-?�\\/\"]+", -1);
	}
464093
public static String normalize( String text ) {
        CheckArg.isNotNull(text, "text");
        // This could be much more efficient.
        return NORMALIZE_PATTERN.matcher(text).replaceAll(" ").trim();
    }
1230011
public static String toCell(String text)
	{
		return new StringBuilder("\"")
				.append(format(text))
				.append("\"").toString();
	}
1000383
public static String htmlify(String text) {
		String emojifiedStr = emojify(text);
		return htmlifyHelper(emojifiedStr, false, false);
	}
871969
public void setText (String text) {
		if (content instanceof VisLabel) {
			((VisLabel) content).setText(text);
		} else {
			setContent(new VisLabel(text));
		}
		pack();
	}