i was given help to create a code to count operaters such as:- '+','-', '*', '/', etc..... this works fine to count number of operaters which are a single character, but i a m having trouble counting operaters which are words such:- "if", "else", "while", ect..... i tried to modify the code counting single character operaters but i keep gettin a error.
i get the following error:
H:\qp&e\1\StringCount.java:52: cannot resolve symbol symbol : method toStringArray () location: class java.lang.String String cReadline = sReadLine.toStringArray(); ^ 1 error Finished
Hello Sukh, I'm not sure this is what you're looking for. But heres a simple program that counts the occurance of a given word (if) in a sentence. In your case, sReadLine will contain the first line as a String, right?. So, you can read the line and then pass that string into stringtokenizer instead of s, which i used.
Note, im a beginner in java but to the best of my knowledge, it should work ( i tried it and worked like a charm). i don't know how efficient is it though. But give it a go. Good Luck.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com