public class StringTools
extends java.lang.Object
| Constructor and Description |
|---|
StringTools() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.String[] |
guardedSplit(java.lang.String str,
java.lang.String delim,
char protect)
splits the string, guarding the space within protect.
|
static void |
main(java.lang.String[] args) |
static java.lang.String |
spaces(int count)
Java 11 uses " ".repeat(n), so get Java 8 code
ready for this.
|
public static java.lang.String[] guardedSplit(java.lang.String str,
java.lang.String delim,
char protect)
s= """2009,0,2,"Hot riser,spark",99"""
could be split into five fields with guardedSplit(s,',','"').str - the string to split.delim - the delimiter we split on. (similar to s.split(delim,-2))protect - character that blocks off delimiter, such as quote.public static java.lang.String spaces(int count)
count - public static void main(java.lang.String[] args)