codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  questions on java  kkai at 13:42 on Thursday, September 06, 2007
 

hi i am new to java and i got some problems here.
simply i just want to code a program to count the words, syllables and sentences in a doucment. But i dont know how to code that, hope someone will help me out.

  Re: questions on java  kanad at 04:34 on Monday, September 10, 2007
 

use Stringtokenizer
Something like this

int lineCount=0;
String lineSeperator="";
String docString="Hello This is test for\n text example";
StringTokenizer toeknizer = new StringTokenizer(docString);
System.out.println("Words Found "+toeknizer.countTokens());
toeknizer = new StringTokenizer(docString,"\n");
lineCount=toeknizer.countTokens();
lineSeperator = System.getProperty("line.separator");
toeknizer = new StringTokenizer(docString,lineSeperator);
lineCount=lineCount+toeknizer.countTokens();
System.out.println("Lines Found "+lineCount);









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  mkdirs
•  Re: Web Development Project
•  ** Site Hacked ** javascript inserted...
•  Losing background/text color when converting HTML to PDF
•  hidden div block when displayed, displays at an offset of 200px only in IE 6..
•  help - sketch
•  Re: Perl Script - File Handling.
•  Open a file from website
•  Re: to open 5 terminals from one and also execute different commands on each terminal


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2008