public final class GStringUtil
extends Object
This class is primarily intended for INTERNAL USE. Use at your own risk.
| Type Params | Return Type | Name and description |
|---|---|---|
|
public static void |
buildImpl(GroovyObject builder, Object[] vs, String[] ss)Yields each string, and each following value, through builder.
|
|
public static int |
calcInitialCapacityImpl(Object[] vs, String[] ss)Estimates a buffer size from the literal strings. |
|
public static GString |
plusImpl(Object[] thisValues, Object[] thatValues, String[] thisStrings, String[] thatStrings)Returns a new GStringImpl that concatenates the left and right parts. |
|
public static Writer |
writeToImpl(Writer out, Object[] vs, String[] ss)Writes each string in ss, and, when vs has an element at the
same index, that value. |
Yields each string, and each following value, through builder.
For every string, and for a value at the same index when one exists,
the property mkp is read and then yield is invoked with
that string or value. The property read's result is discarded.
builder - the builder that receives mkp and yieldvs - the interpolated valuesss - the literal strings Estimates a buffer size from the literal strings. Sums ss[i].length().
When ss is non-empty, adds vs.length times the greater of
that sum divided by ss.length (integer division) and 8. Returns the
greater of 120% of that total, truncated to int, and 16. Value
contents are not inspected. An empty ss yields 16.
vs - values, used only for vs.lengthss - literal strings whose lengths are summed Returns a new GStringImpl that concatenates the left and right parts.
The input arrays are not modified. Values are copied left then right.
When thisStrings is longer than thisValues, the last left
string is concatenated with the first right string and the remaining right
strings follow, so the boundary does not insert an empty value. Otherwise
the right strings are copied in full.
thisValues - values from the left GStringthatValues - values from the right GStringthisStrings - strings from the left GStringthatStrings - strings from the right GString Writes each string in ss, and, when vs has an element at the
same index, that value. A Closure value with no parameters is called
and FormatHelper.write writes the call's result. A
closure with one parameter is called with out and its result is not
written. Any other value, including null, is passed to
FormatHelper.write. Returns the same writer.
A closure value that takes more than one parameter is rejected.
out - the writer that receives the textvs - the interpolated valuesss - the literal stringsout