I have the folllowing piece of Java in which I want to add a String inside a statement:
@and (\"^I want to change fieldnumber \\\"([^\\\"]*)\\\" ,
What about
driver.findElement(By.xpath("//*[contains(@name,\"template:view:" + number+ ":item:view:1:item:\")]")).clear();
And you probably need the number to be const, that means:
public void testscenario12345(final String number, String text) throws Throwable {