MCPcopy Create free account
hub / github.com/dynjs/dynjs / trimString

Method trimString

src/main/java/org/dynjs/runtime/Types.java:145–165  ·  view source on GitHub ↗
(String value)

Source from the content-addressed store, hash-verified

143 }
144
145 public static String trimString(String value) {
146 int len = value.length();
147 int st = 0;
148 char[] val = value.toCharArray();
149
150 while ((st < len) && (isWhitespace(val[st]))) {
151 st++;
152 }
153 while ((st < len) && (isWhitespace(val[len - 1]))) {
154 len--;
155 }
156
157 String result = null;
158
159 if ( st > 0 || len < value.length() ) {
160 result = value.substring(st,len);
161 } else {
162 result = value;
163 }
164 return result;
165 }
166
167 public static String trimNumericString(String value) {
168 char[] val = value.toCharArray();

Callers 1

callMethod · 0.95

Calls 2

isWhitespaceMethod · 0.95
lengthMethod · 0.80

Tested by

no test coverage detected