Class StringUtils

java.lang.Object
com.github.tommyettinger.textra.utils.StringUtils

public final class StringUtils
extends java.lang.Object
  • Method Summary

    Modifier and Type Method Description
    static java.lang.String join​(java.lang.CharSequence delimiter, java.lang.CharSequence... items)  
    static java.lang.String shuffleWords​(java.lang.String text)
    Shuffles the words in text using MathUtils.random, joins them with a space as the delimiter, and returns that String.
    static java.lang.String shuffleWords​(java.lang.String text, java.util.Random generator)
    Shuffles the words in text using the given Random generator, joins them with a space as the delimiter, and returns that String.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • join

      public static java.lang.String join​(java.lang.CharSequence delimiter, java.lang.CharSequence... items)
    • shuffleWords

      public static java.lang.String shuffleWords​(java.lang.String text)
      Shuffles the words in text using MathUtils.random, joins them with a space as the delimiter, and returns that String.
      Parameters:
      text - a String containing typically many whitespace-separated words
      Returns:
      text with its words shuffled randomly
    • shuffleWords

      public static java.lang.String shuffleWords​(java.lang.String text, java.util.Random generator)
      Shuffles the words in text using the given Random generator, joins them with a space as the delimiter, and returns that String. The generator can be seeded to get replicable results.
      Parameters:
      text - a String containing typically many whitespace-separated words
      Returns:
      text with its words shuffled randomly