exercism / exercism/java-analyzer

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

Abierto
#176 1 comentario 0 reacciones 1 asignado Reclamado por @manumafe98 Ver en GitHub
x:size/small
Lenguaje dominante
Java
Estrellas
13
Forks
27
Merge medio
4 d 9 h
PR fusionados (30 d)
6

Descripción

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](https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#substring-int-int-) method in result to solve this exercise. but for this exercise the substring method is implemented in the other methods, kindly review.

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.