@CompileStatic class StringUtil extends Object
String utility functions.
Constructor and description |
---|
StringUtil() |
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. |
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).
x
- the value for the bar to be drawnmin
- the minimum valuemax
- the maximum valuewidth
- how many characters should the maximum value be rendered as (default 40)Copyright © 2003-2024 The Apache Software Foundation. All rights reserved.