0
A
回答
0
我試過了。
> cat test
Honesty
World
Hello
world
Hello
honesty
> sort -uf test
Hello
Honesty
World
> sort -uf test | tr A-Z a-z
hello
honesty
world
感謝您的幫助。
0
- 讀一個字
- 將它轉換爲小寫
- 重複檢查與某種集/散列表之類的事情。
例如,在C++中,你可以使用這樣的事情:
#include <set>
#include <string>
#include <iostream>
#include <algorithm>
#include <ctype.h>
struct lowercase {
std::string operator()(std::string const &s) const {
std::string ret(s);
std::transform(&s[0], &s[s.length()-1], &ret[0], tolower);
return ret;
}
};
int main() {
std::set<std::string> items;
std::transform(
std::istream_iterator<std::string>(std::cin),
std::istream_iterator<std::string>(),
std::inserter(items, items.begin()),
lowercase());
std::copy(items.begin(), items.end(),
std::ostream_iterator<std::string>(std::cout, "\n"));
return 0;
}
相關問題
- 1. 如何刪除相同的單詞?
- 2. Flex如何區分大寫單詞,小寫單詞和單詞?
- 3. 從文本中消除停用詞,同時不刪除重複的常規詞
- 4. 如何刪除單詞前的文本?
- 5. 從文本文件中刪除重複單詞
- 6. 刪除全部大寫/小寫的單詞。 C++
- 7. 記事本++刪除所有不在單詞表中的單詞
- 8. Git刪除不同大小寫的相同文件
- 9. 從數組刪除重複的單詞和返回唯一相同的數組
- 10. 在R中用相同的單詞替換沒有初始@的相同單詞
- 11. 如何大寫單詞
- 12. 從文本中刪除單詞/數字
- 13. 如何刪除重複的單詞在字符串中的MATLAB
- 14. 單獨的空格分隔單詞並刪除重複的單詞
- 15. 如何刪除詞典列表中,如果相同的單詞在另一份名單(Python 2.7版)
- 16. 刪除單詞中的任何非單詞字符,但空格和單引號
- 17. 如何獲取每個單詞的第一個字母是不同的大小,其餘大小相同
- 18. 刪除R中單元格的重複單詞
- 19. 如何找到單詞中的重複單詞?
- 20. (Python)中的單詞大寫?
- 21. 在兩個文本文件中查找相同的單詞
- 22. 刪除文本框中的空格但不包含單詞之間的文本
- 23. 替換數組中的重複單詞(不刪除)
- 24. 刪除相同的「關鍵詞」模式
- 25. 在相同的String []中反轉單詞?
- 26. 如何區分SELECT查詢中的大寫或小寫單詞
- 27. 重寫URL中的單詞
- 28. 刪除字符串中的特定單詞(不區分大小寫)
- 29. 在同一個文本框中使不同的單詞有不同的字體大小使用VBA
- 30. 在同一個單詞上使用大小寫字母
哪種語言? – 2010-06-23 18:26:12
你想寫一個程序來做到這一點?或者你只是有一個文本文件需要編輯一次,而你只是尋找一個工具來幫助它? – David 2010-06-23 18:31:17
哪plataform? – pcent 2010-06-23 18:31:24