它关于文本处理在linux使用c ++ [英] it about hindi text proccessing in in linux using c++

查看:168
本文介绍了它关于文本处理在linux使用c ++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用c ++在linux中处理文档任何建议。
我想从UTF-8编码的文件中读取一个文件,并处理它,即从中找到一个
特定的字。我们如何做呢?

How to do processing on hindi text using c++ in linux any suggestions. I want to read a hindi text from file encoded in UTF-8 and process it that is to find a specific word from that . How can we do it??

推荐答案

utf8的设计意味着你不必采取任何特殊的编码特定步骤。基于 char 的C ++标准库函数都是8位干净的,所以它们都可以使用utf-8 (除了密码环境c $ c> char 不是8位)

The design of utf8 means that you don't have to take any special encoding specific steps. The C++ standard library functions that are based on char are all 8 bit clean, so they'll all work with utf-8 (except for esoteric environments where char isn't 8 bits).

std::string word = /*the word you are looking for, encoded in utf8*/;
std::string fileContents = /*the file contents*/;

std::string::iterator location = fileContents.find(word);

这篇关于它关于文本处理在linux使用c ++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆