Click here to Skip to main content
15,867,964 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have scenario where i need to split the bstr into two seperate bstr using a delimiter.
Is there any API/macro available
Posted

You may use the methods provided by another string class, for instance std::wstring.
e.g. (using a blank as delimiter):
C++
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();
 
Share this answer
 
v2
Comments
explorerC 22-Sep-11 9:19am    
Hi there
If i use wstring Im getting the below error.
error C2039: 'wstring' : is not a member of 'std'

My project is and ATL COM Server project .Do i need to include anything
CPallini 22-Sep-11 9:24am    
Yes you need to include the string header:
#include <string>
explorerC 22-Sep-11 9:31am    
Thanks ........gr8
CPallini 22-Sep-11 16:27pm    
You are welcome.
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!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900