daniwu hat gesagt.:Hab es mit der
replace Methode versucht, aber das hat noch nicht mal für einen Buchstaben geklappt.
String vorname = new String ("Daöiel");
String tmpString = vorname.replace( 'a', 'l');
System.out.println( "Original = " + vorname );
System.out.println( "Result = " + vorname );
String replace(name,'j', 'l');
Original = Daöiel
Result = Daöiel
System.out.println( "Original = " + vorname );
System.out.println( "Result = " + vorname );
System.out.println("Result = " + tmpString");
public class Probe {
public static void main(String args[])
{
int pos, laenge, i;
String input = "REXREX", firstpart = "", secondpart = "";
//ab hier
laenge = input.length();
for (i = 0; i != laenge;)
{
laenge = input.length();
pos = input.indexOf('X');
if (pos != -1)
{
firstpart = input.substring(0, pos);
if (pos + 1 != laenge)
{
secondpart = input.substring(pos + 1, laenge);
}
else
{
secondpart = "";
}
input = firstpart + "CKS" + secondpart;
}
else
{
i = laenge;
}
laenge = input.length();
}
//bis hier
System.out.println(input);
}
}