StringUtil (Groovy 5.0.7)

Package: org.codehaus.groovy.util

## [Groovy] Class StringUtil

- org.codehaus.groovy.util.StringUtil

-     @CompileStatic
      class StringUtil
      extends Object

  String utility functions.

- - ### Constructor Summary

    Constructors
    Constructor and description
    `StringUtil()`

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `static String` | `bar(Number x, Number min, Number max, int width)` Draw a band whose width is proportional to (x - min) and equal to width when x equals max.
    `` | `static String` | `tr(String text, String source, String replacement)` Provides Groovy with functionality similar to the unix tr command which translates a string replacing characters from a source set with characters from a replacement set.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### StringUtil()

  - ### Method Detail

    - #### static String bar(Number x, Number min, Number max, int width)

      Draw a band whose width is proportional to (x - min) and equal to width when x equals max. Unicode block element characters are used to draw fractional blocks. A 1/8 block is always added at the start of the bar. If using Windows command-line, make sure you are using the Unicode codepage (65001) and a font that supports block elements (like Cascadia).

      Parameters:
        `x` - the value for the bar to be drawn
        `min` - the minimum value
        `max` - the maximum value
        `width` - how many characters should the maximum value be rendered as (default 40)
      Returns:
        the rendered ascii barchart string
      Since:
        5.0.0

    - #### static String tr(String text, String source, String replacement)

      Provides Groovy with functionality similar to the unix tr command which translates a string replacing characters from a source set with characters from a replacement set.

      Since:
        1.7.3