首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
社区首页 >问答首页 >如何在另一个utf8_string中使用C++11中的tinyutf8查找utf8_string?

如何在另一个utf8_string中使用C++11中的tinyutf8查找utf8_string?
EN

Stack Overflow用户
提问于 2018-09-15 01:46:05
回答 1查看 119关注 0票数 1

我使用的是来自https://github.com/DuffsDevice/tinyutf8的tinyutf8 C++ UTF-8字符串库

我尝试调用utf8_string::find_first_of,并将utf8_string作为第一个参数传递。

这将生成以下错误:

代码语言:javascript
运行
AI代码解释
复制
error: no matching function for call to ‘utf8_string::find_first_of(utf8_string&, int&)’
int found_pos = haystack.find_first_of(needle, at_pos);
^
In file included from Phonemizer.cpp:8:0:
tinyutf8.h:1728:12: note: candidate: utf8_string::size_type utf8_string::find_first_of(const value_type*, utf8_string::size_type) const
size_type find_first_of( const value_type* str , size_type start_codepoint = 0 ) const ;
^~~~~~~~~~~~~
tinyutf8.h:1728:12: note: no known conversion for argument 1 from ‘utf8_string’ to ‘const value_type* {aka const char32_t*}

如何从我的utf8_string获取char32_t*?或者,还有什么其他机制可以在另一个utf8_string中查找utf8_string

谢谢!肖恩

EN

回答 1

Stack Overflow用户

发布于 2018-11-14 21:11:47

Shawn,目前tiny_utf8不支持使用utf8_string作为参数的find_first_of。但是,为了回答您的第二个问题:您可以使用utf8_string::to_wide_literal( &char32_buffer )utf8_string转换为char32_t[]

我希望这至少会有一点帮助(尽管你说你自己已经解决了这个问题,我很高兴听到这个:D)。

一切顺利,雅各布

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/52340945

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档