java 作业求解答

下面是题目要求我不明白的是如何估计file中单词的数量然后创建一个array的数组例如Sting[]words=newString[ESTIMATED_SIZE]然后把单... 下面是题目要求 我不明白的是如何估计file中单词的数量 然后创建一个array的数组例如Sting[] words = new String [ESTIMATED_SIZE] 然后把单词存在数组中 存了之后此时如果String[1]的话是一个字母呢还是一个单词呢 还有有可能存为单词吗 求大神~
You have been asked to read a text file word by word, and then use quicksort to sort the words in alphabetical order, and save them in sorted order in another file with following specifications:
Prompt user to input for file names.
Estimate the number of the words in the file, and then create an array of String such as Sting[] words = new String [ESTIMATED_SIZE] and store words in the array.
Change all word to lower case.
If words have a punctuation symbol in the beginning or at the end of the words, then remove the punctuation marks from the word, and keep the word.
You need to remove the following punctuation marks from each word; [ '.' (dot), ',' (comma), ';' (semi-colon), ':' (colon), '?' (question mark), '!' (exclamation), ' " ' (double quotation), ' \' ' (single quotation) , ')' (opening parentheses) , and '(' (closing parenthesis )].
If words still have any symbol except '-' (hyphen), then ignore the words.
Get rid of the the hyphen(s) that are not inside a word.
Get rid of the words that contain digits.
Get rid of spaces from both side of the words.
Save the file in unique order. If there are many occurrences of the same word, then save only one of isntance of the word.
展开
 我来答
hirondelle3
2015-11-21 · 超过12用户采纳过TA的回答
知道答主
回答量:73
采纳率:0%
帮助的人:26万
展开全部
字符串分割,以逗号空格,StringUtils就行,再去重。
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式