A
Anony!
Hi
<code snippet>
public String manipulator(String s)
{
String str "";
for (int i=s.length()-1; i>0; i--)
{
str = str + s.charAt(i);
if (str.charAt(i) == 'a')
str.charAt(i) = 't'; //doesnt like this
}
return str;
}
trying to replace a character ('a') in a string to a character ('t').
i thought about using the string replace() method, but i realise that i dont
wont to replace all occurences of a character with another - just a single
event.
Thanks in advance
AaA
<code snippet>
public String manipulator(String s)
{
String str "";
for (int i=s.length()-1; i>0; i--)
{
str = str + s.charAt(i);
if (str.charAt(i) == 'a')
str.charAt(i) = 't'; //doesnt like this
}
return str;
}
trying to replace a character ('a') in a string to a character ('t').
i thought about using the string replace() method, but i realise that i dont
wont to replace all occurences of a character with another - just a single
event.
Thanks in advance
AaA