MCPcopy
hub / github.com/libgdx/libgdx / replaceFirst

Method replaceFirst

gdx/src/com/badlogic/gdx/utils/CharArray.java:246–257  ·  view source on GitHub ↗

Returns true if the specified value was replaced successfully with the replacement @param value the char to be replaced @param replacement the first value will be replaced by this replacement if found @return if value was found and replaced

(char value, char replacement)

Source from the content-addressed store, hash-verified

244 * @param replacement the first value will be replaced by this replacement if found
245 * @return if value was found and replaced */
246 public boolean replaceFirst (char value, char replacement) {
247 if (value != replacement) {
248 char[] items = this.items;
249 for (int i = 0, n = size; i < n; i++) {
250 if (items[i] == value) {
251 items[i] = replacement;
252 return true;
253 }
254 }
255 }
256 return false;
257 }
258
259 /** Returns the number of replacements done.
260 * @param value the char to be replaced

Callers 1

replaceTestMethod · 0.95

Calls 3

indexOfMethod · 0.95
replaceMethod · 0.95
lengthMethod · 0.45

Tested by 1

replaceTestMethod · 0.76