What's the best way to determine the total number of words of a file in Java?

前端 未结 6 1272
一向
一向 2021-01-14 01:28

What is the best way to find the total number of words in a text file in Java? I\'m thinking Perl is the best on finding things such as this. If this is true then calling a

6条回答
  •  温柔的废话
    2021-01-14 02:12

    While Perl can do this, I'd consider it overkill to link it in / call it for this kind of task (unless you already have that tested out).

    • My suggestion would be to lookfor & learn from code that does what you need on the web, e.g. here: http://schmidt.devlib.org/java/word-count.html

提交回复
热议问题