ok got it, will check
sweet, got it to work! thx
public class changePi {
public String changeToPi(String str){
String total = "";
if (str.length() < 4 && !str.equals("3.14"))
{
return str;
}
if (str.length() >= 4)
{
if (str.substring(0, 4).equals("3.14"))
{
total = "pi";
total = total + changeToPi(str.substring(4));
}
else if (!str.substring(0, 4).equals("3.14"))
{
total = str.substring(0,1);
total = total + changeToPi(str.substring(1));
}
}
return total;
}
public static void main (String args[]){
changePi um = new changePi();
String newPi;
newPi = um.changeToPi("3.14ih3.14.56ih3ih");
System.out.println(newPi);
}
}