I've constructed a method that combines the use of a string tokeniser and string builder to translate words in a string to other words. This method though just seems to produce errors. Can someone take a look at this method and please explain what it is I'm doing wrong.
Code:public void String replacePirate(String +pirate+, String +english+) { (class, interface or enum expected)
StringBuilder result = new StringBuilder(original.length());
String delimiters = "+-*/(),. ";
StringTokenizer st = new StringTokenizer(+pirate+, delimiters, true);
while (st.hasMoreTokens()) {
String w = st.nextToken();
if (w.equals(find)) {
result.append(+english+);
} else {
result.append(w);
}
}
return result.toString();
}

