Hello, I have been trying to figure out how to make it so that if my method called test is given a parameter that equals bold, it will take the reply string and concatenate two asterisks on both sides of the string and return it. I have manually done this but when it comes down to having three parameters such as 3 modifiers, you have yourself 64 combinations and I'd like to be able to do 4 and not have to write 256 lines of code. this is my code so far, the first block is the test method that I can't even figure out where to start, and the second one,(which will not run since it requires multiple other files), is the manual version that I am trying to automate.
public class main {
public static void main(String[] args) {
}
public static void test(String test){
String reply = "";
switch(test){
case "bold" ->{
reply = "**"+"dwdaw"+"**"
}
}
}
}
public static String mod(String mod,String textOption){
String reply = "";
switch(mod.toLowerCase()){
case "bold" ->{reply = "**" + textOption + "**";}
case "italic" ->{reply = "*" + textOption + "*";}
case "strike" ->{reply = "~~" + textOption + "~~";}
case "under" ->{reply = "__" + textOption + "__";}
default ->{reply = "invalid modifier";}
}
return reply;
}