MCPcopy Create free account
hub / github.com/ReadyTalk/avian / trim

Method trim

classpath/java/lang/String.java:230–254  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

228 }
229
230 public String trim() {
231 int start = -1;
232 for (int i = 0; i < length; ++i) {
233 char c = charAt(i);
234 if (start == -1 && ! Character.isWhitespace(c)) {
235 start = i;
236 break;
237 }
238 }
239
240 int end = -1;
241 for (int i = length - 1; i >= 0; --i) {
242 char c = charAt(i);
243 if (end == -1 && ! Character.isWhitespace(c)) {
244 end = i + 1;
245 break;
246 }
247 }
248
249 if (start >= end) {
250 return "";
251 } else {
252 return substring(start, end);
253 }
254 }
255
256 public String toLowerCase() {
257 for (int j = 0; j < length; ++j) {

Callers 2

getBytesMethod · 0.45
finishLineMethod · 0.45

Calls 3

charAtMethod · 0.95
isWhitespaceMethod · 0.95
substringMethod · 0.95

Tested by

no test coverage detected