我使用的是来自https://github.com/DuffsDevice/tinyutf8的tinyutf8 C++ UTF-8字符串库
我尝试调用utf8_string::find_first_of
,并将utf8_string作为第一个参数传递。
这将生成以下错误:
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
谢谢!肖恩
发布于 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)。
一切顺利,雅各布
https://stackoverflow.com/questions/52340945
复制相似问题