字符串处理有关问题

WBOY
Release: 2016-06-13 13:45:46
Original
893 people have browsed it

字符串处理问题
zh(中文)en(英文)ja(日文)

以上字符串,
如果语言是zh就显示“中文”
如果语言是en就显示“英文”
如果语言是ja就显示“日文”

请问怎么实现这样的功能

------解决方案--------------------
... ...还没纠结完啊?

这个我记得你不是解决了吗?什么是显示日文?显示日语?还是显示 日文 这个中文词汇?

------解决方案--------------------
我没有验证过这个方法。不过收藏过一个关于正则的网站,供你分享。
参考:http://www.regular-expressions.info/unicode.html。

可以尝试用正则判断,比如中文文字的编码范围: U+4E00..U+9FFF,

再笨一点的方法,接一个GOOGLE翻译API,利用google判断文字的语言。

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!