| 124 | */ |
| 125 | //@Immutable |
| 126 | public class StringUtils { |
| 127 | |
| 128 | // Performance testing notes (JDK 1.4, Jul03, scolebourne) |
| 129 | // Whitespace: |
| 130 | // Character.isWhitespace() is faster than WHITESPACE.indexOf() |
| 131 | // where WHITESPACE is a string of all whitespace characters |
| 132 | // |
| 133 | // Character access: |
| 134 | // String.charAt(n) versus toCharArray(), then array[n] |
| 135 | // String.charAt(n) is about 15% worse for a 10K string |
| 136 | // They are about equal for a length 50 string |
| 137 | // String.charAt(n) is about 4 times better for a length 3 string |
| 138 | // String.charAt(n) is best bet overall |
| 139 | // |
| 140 | // Append: |
| 141 | // String.concat about twice as fast as StringBuffer.append |
| 142 | // (not sure who tested this) |
| 143 | |
| 144 | /** |
| 145 | * This is a 3 character version of an ellipsis. There is a Unicode character for a HORIZONTAL ELLIPSIS, U+2026 '…', this isn't it. |
| 146 | */ |
| 147 | private static final String ELLIPSIS3 = "..."; |
| 148 | |
| 149 | /** |
| 150 | * A String for a space character. |
| 151 | * |
| 152 | * @since 3.2 |
| 153 | */ |
| 154 | public static final String SPACE = " "; |
| 155 | |
| 156 | /** |
| 157 | * The empty String {@code ""}. |
| 158 | * |
| 159 | * @since 2.0 |
| 160 | */ |
| 161 | public static final String EMPTY = ""; |
| 162 | |
| 163 | /** |
| 164 | * The null String {@code null}. Package-private only. |
| 165 | */ |
| 166 | static final String NULL = null; |
| 167 | |
| 168 | /** |
| 169 | * A String for linefeed LF ("\n"). |
| 170 | * |
| 171 | * @see <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.6">JLF: Escape Sequences |
| 172 | * for Character and String Literals</a> |
| 173 | * @since 3.2 |
| 174 | */ |
| 175 | public static final String LF = "\n"; |
| 176 | |
| 177 | /** |
| 178 | * A String for carriage return CR ("\r"). |
| 179 | * |
| 180 | * @see <a href="https://docs.oracle.com/javase/specs/jls/se8/html/jls-3.html#jls-3.10.6">JLF: Escape Sequences |
| 181 | * for Character and String Literals</a> |
| 182 | * @since 3.2 |
| 183 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…