hello,
I'm trying to create a method to remove duplicate char from a Stringbuilder so if I inputted 'ttttttt' I would
only be returned with 't' my method at the moment is
public static String Dups(String aString)
{
StringBuilder aSB = new StringBuilder(aString);
for (int i = 0;i<aSB.length();i++)
{
if(aSB.charAt(i)==aSB.charAt(i++))
{
aSB.deleteCharAt(i);
}
}
return aSB.toString();
}
The code is remove some 't''s but not all duplicates
does anyone know where I'm going wrong?
Thanks