On 6/6/2018 8:11 PM, Weijun Wang wrote:
Utilities.java:
39 static final char[] hexDigits = "0123456789ABCDEF".toCharArray();
40 private static final String indent = " ";
41 private static final Pattern lineBreakPatern =
42 Pattern.compile("\\r\\n|\\n|\\r");
Use UPPERCASE letters for final static fields.
When the type is other than primitive type, using UPPERCASE may be not a
better choice. For example, LINE_BREAK_PATERN.split() looks weird to me.
Anyway, if you like to use UPPERCASE letters, I will make an update.
147 static String indent(String source, String prefix) {
148 StringBuilder builder = new StringBuilder();
149 if (source == null) {
150 builder.append("\n" + prefix + "<blank message>");
151 } else {
152 String[] lines = lineBreakPatern.split(source);
The split call would remove existing newline(s) at the end. Is this what you
intended?
Yes, it is intended.
Xuelei