I want to replace 1 by 1Min, 5 by 5Min, 10 by 10Min, 15 by 15Min,60 by 1Hour, 360 by 6Hours etc.
How can I do it in 1 statement.
String str = "15";
String newStr = str.replace("1", "1Min").replace("5", "5Mins").replace("10", "10Mins").replace("15", "15Mins").replace("30", "30Mins").replace("60", "1Hr").replace("120", "2Hrs").replace("240", "4Hrs").replace("480", "8Hrs").replace("720", "12Hrs").replace("1440", "24Hrs");
If I try this, i get '1Min5Mins' because it replaces 1 and then 5.
This could be a stupid question, I can do it with switch or if, else-if. just wondering can this be done in 1 line code.
Thanks