Skip to content

Commit

Permalink
Add COMMA const
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Dec 24, 2024
1 parent c38d566 commit 2b7a81d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
*/
public class StringUtils {

/**
* A predicate that tests if a character is a comma.
*/
public static final Predicate<Character> COMMA = o -> o == ',';

/**
* A predicate that tests if a character is a comma or semicolon.
*/
Expand Down Expand Up @@ -369,7 +374,6 @@ public static void splitMap(final String source, final Predicate<Character> pred
char ch;
int pos = -1;
int length = source.length();
String part;

// Iterate over characters
for (int i = 0; i < length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.List;

import static com.jd.live.agent.core.util.StringUtils.COMMA;
import static com.jd.live.agent.core.util.StringUtils.splitList;

/**
Expand Down Expand Up @@ -69,7 +70,7 @@ static List<String> parseValue(String value) {
if (value.length() == 2) {
result = new ArrayList<>();
} else {
result = splitList(value.substring(1, value.length() - 1), ',');
result = splitList(value.substring(1, value.length() - 1), COMMA);
}
} else {
result = new ArrayList<>(1);
Expand Down

0 comments on commit 2b7a81d

Please sign in to comment.