Hi
I am trying a program to build a method that combines the use of a string tokenizers and string builder. This will translate words in a string to other words. But the problem is that it is the method is giving an error. Can someone tell me how to solve this problem. please help. Thanks in advance.
Code:
public void String reppirate(String +pirate+, String +english+) { (class, interface or enum expected)
StringBuilder rst = new StringBuilder(original.length());
String delmt = "+-*/(),. ";
StringTokenizer st = new StringTokenizer(+pirate+, delmt, true);
while (st.hasMoreTokens()) {
String w = st.nextToken();
if (w.equals(find)) {
rst.append(+english+);
} else {
rst.append(w);
}
}
return rst.toString();
}
Bookmarks