there is no need to use substring in the result method in this code, kindly review

Đang mở
#176 1 bình luận 0 reaction 1 người được giao Xem trên GitHub

@manumafe98 đang làm issue này rồi.

Từ ngày 23/5/2024.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

x:size/small

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.

Ngôn ngữ chính
Java
Star
13
Fork
27
Merge trung bình
4 ngày 17 giờ
Pull request đã merge (30 ngày)
7

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của exercism/java-analyzer

Tất cả issue của exercism/java-analyzer

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.