Skip to content

Commit 52cb4de

Browse files
committed
Rename to match String style of naming
1 parent 9830ec0 commit 52cb4de

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

src/main/java/org/apache/commons/cli/help/TextHelpAppendable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ protected Queue<String> makeColumnQueue(final CharSequence columnData, final Tex
318318
nextPos = findWrapPos(columnData, workingWidth, wrapPos);
319319
final CharSequence working = columnData.subSequence(wrapPos, nextPos);
320320
result.add(lpad + style.pad(wrapPos > 0, working));
321-
wrapPos = Util.findNonWhitespacePos(columnData, nextPos);
321+
wrapPos = Util.indexOfNonWhitespace(columnData, nextPos);
322322
wrapPos = wrapPos == -1 ? nextPos : wrapPos;
323323
}
324324
return result;

src/main/java/org/apache/commons/cli/help/Util.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ static <T extends CharSequence> T defaultValue(final T str, final T defaultValue
4949
}
5050

5151
/**
52-
* Finds the position of the first non whitespace character.
52+
* Finds the index of the first non whitespace character.
5353
*
5454
* @param text the text to search in.
5555
* @param startPos the starting position to search from.
5656
* @return the index of the first non whitespace character or -1 if non found.
5757
*/
58-
static int findNonWhitespacePos(final CharSequence text, final int startPos) {
58+
static int indexOfNonWhitespace(final CharSequence text, final int startPos) {
5959
if (isEmpty(text)) {
6060
return -1;
6161
}
@@ -93,7 +93,7 @@ static boolean isWhitespace(final char c) {
9393
* @return The String of without the leading padding
9494
*/
9595
static String ltrim(final String s) {
96-
final int pos = findNonWhitespacePos(s, 0);
96+
final int pos = indexOfNonWhitespace(s, 0);
9797
return pos == -1 ? "" : s.substring(pos);
9898
}
9999

src/test/java/org/apache/commons/cli/help/UtilTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,17 @@ public static Stream<Arguments> charArgs() {
6060

6161
@Test
6262
public void testFindNonWhitespacePos() {
63-
assertEquals(-1, Util.findNonWhitespacePos(null, 0));
64-
assertEquals(-1, Util.findNonWhitespacePos("", 0));
63+
assertEquals(-1, Util.indexOfNonWhitespace(null, 0));
64+
assertEquals(-1, Util.indexOfNonWhitespace("", 0));
6565
}
6666

6767
@ParameterizedTest
6868
@MethodSource("charArgs")
6969
public void testFindNonWhitespacePos(final Character c, final boolean isWhitespace) {
7070
String text = format("%cWorld", c);
71-
assertEquals(isWhitespace ? 1 : 0, Util.findNonWhitespacePos(text, 0));
71+
assertEquals(isWhitespace ? 1 : 0, Util.indexOfNonWhitespace(text, 0));
7272
text = format("%c%c%c", c, c, c);
73-
assertEquals(isWhitespace ? -1 : 0, Util.findNonWhitespacePos(text, 0));
73+
assertEquals(isWhitespace ? -1 : 0, Util.indexOfNonWhitespace(text, 0));
7474
}
7575

7676
@Test

0 commit comments

Comments
 (0)