Test Class

 @Test
    public void testCharRemover() {
        TextModifier remover = new CharRemover('x');
        StringBuilder buff = new StringBuilder("a bx xd xx");
        remover.modifyText(buff);
        Assert.assertEquals("a b d ", buff.toString());
    }

-------------------------------------------------------

/**
 * Removes all occurrences of the character passed to the constructor
 * from the input when {@link TextModifier#modifyText(StringBuilder)}
 * is called.
 */
public class CharRemover implements TextModifier {
    // TODO

    public CharRemover(char charToRemove) {
        // TODO
    }

----------------------------------------------------

I am confused where to start. I know that I have to take in the string and remove the "x" and then return the string. But thats about it.

What you need to do are obvious and stated in the CharRemover class.

1)You need to declare local variables for the class. In this case, you need at least one variable type char which will hold the incoming value from the constructor.
2)You need to implement a method modifyText() that takes in StringBuilder class. Inside the method, you need to modify the passed in StringBuilder variable.

That's all you need to do from the requirement.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.