如何将一个bstr分成两个bstr [英] How to split a bstr into two bstr's

查看:113
本文介绍了如何将一个bstr分成两个bstr的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到需要使用定界符将bstr分成两个单独的bstr的情况.
是否有可用的API/宏

I have scenario where i need to split the bstr into two seperate bstr using a delimiter.
Is there any API/macro available

推荐答案

您可以使用其他字符串类提供的方法,例如std::wstring.
例如(使用空格作为分隔符):
You may use the methods provided by another string class, for instance std::wstring.
e.g. (using a blank as delimiter):
bstr_t b = bstr_t(L"Hi folks");
wstring w = b;
wstring::size_type pos = w.find(L' ');
bstr_t b1 = w.substr(0, pos).c_str();
bstr_t b2 = w.substr(pos+1).c_str();


我认为此链接将为此提供一些良好的信息,并引导您进入分析服务公司.
http://www.johndcook.com/cplusplus_strings.html [
I think this link will provide some good information on this and will lead you to the anser.
http://www.johndcook.com/cplusplus_strings.html[^]

Good luck!


这篇关于如何将一个bstr分成两个bstr的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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