there is no need to use substring in the result method in this code, kindly review
@manumafe98 is already working on this.
Since May 23, 2024.
Assessment
This issue has not been assessed yet.
Description
public class LogLevels {
public static String message(String logLine) {
int startMessageIndex = logLine.indexOf("]:") + 2;
String result = logLine.substring(startMessageIndex, logLine.length());
return result.trim();
}
public static String logLevel(String logLine) {
int startLevelIndex = logLine.indexOf("[") + 1;
int endLevelIndex = logLine.indexOf("]");
return logLine.substring(startLevelIndex, endLevelIndex).toLowerCase();
}
public static String reformat(String logLine) {
return LogLevels.message(logLine) + " (" + LogLevels.logLevel(logLine) + ")";
}
public static void result() {
String logLine = "[ERROR]: Invalid operation";
String formattedString = LogLevels.reformat(logLine);
}
}
and the suggestion is:
Consider using the substring method in result to solve this exercise. but for this exercise the substring method is implemented in the other methods, kindly review.
- Dominant language
- Java
- Stars
- 13
- Forks
- 27
- Avg merge
- 4d 17h
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from exercism/java-analyzer
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
exercism/java-analyzer#298 · 2 comments ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
exercism/java-analyzer#271 · 5 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
exercism/java-analyzer#227 · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 30/100
exercism/java-analyzer#218 · 3 comments ·
-
x:action/create x:knowledge/intermediate x:module/analyzer x:size/medium x:type/coding x:type/content
exercism/java-analyzer#170 · 13 comments · 1 assignee ·
All issues in exercism/java-analyzer
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 90/100
apache/cloudstack#14222 ·
-
[BUG]茶杯方块在取茶时会引发崩溃 Open
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
1.0.0-alpha2 Type/Improvement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/dpdp-accelerator#272 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
apache/rocketmq-dashboard#4860 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·