komarEX
Member
|
from std::string to EE::Str8
I can't find any way to do this. Getting Str8 to std::string was piece a cake, but I just don't know how to convert it back.
Any ideas?
|
|
02-17-2012 09:42 PM |
|
TBJokers
Member
|
RE: from std::string to EE::Str8
Maybe, std::string=(Str8)(MyStr8)(); or, std::string=(Str8)MyStr8;
Man, it's always that semicolon...
|
|
02-17-2012 09:54 PM |
|
komarEX
Member
|
RE: from std::string to EE::Str8
TBJokers, read my post again also topic name.
|
|
02-17-2012 09:56 PM |
|
TBJokers
Member
|
RE: from std::string to EE::Str8
Oh i'm sorry, that's really simple, (Str8)YourStr8=&YourStdString;
Man, it's always that semicolon...
|
|
02-17-2012 09:59 PM |
|
komarEX
Member
|
RE: from std::string to EE::Str8
I'm afraid it's not that simple.
As far as I can see it gives me memory address as a Str8 (text form).
EDIT. Yeh it is like this. I have "0x001AFD34" in Str8 now..
(This post was last modified: 02-17-2012 10:37 PM by komarEX.)
|
|
02-17-2012 10:22 PM |
|
komarEX
Member
|
RE: from std::string to EE::Str8
Anyone?
|
|
02-19-2012 12:45 PM |
|
neo22
Member
|
RE: from std::string to EE::Str8
Hi,
it's probably not the best answer to your question but it will solve your problem.
Code:
EE::Str StdToEEString(std::string str)
{
Int i = 0;
EE::Str eeString;
while(i< (str.length()))
{
eeString += str[i];
i++;
}
return eeString;
}
std::string EEToStdString(EE::Str str)
{
Int i =0;
std::string stdString;
while(i< (str.length()))
{
stdString += str[i];
i++;
}
return stdString;
}
I hope it could help.
|
|
02-19-2012 01:09 PM |
|
Zervox
Member
|
RE: from std::string to EE::Str8
Str8 eestring8 = "converttostdstring";
std::string stdstring =eestring8();
Str8 backtoeestring8 = stdstring.c_str();
(This post was last modified: 02-19-2012 03:18 PM by Zervox.)
|
|
02-19-2012 03:11 PM |
|
komarEX
Member
|
RE: from std::string to EE::Str8
neo22 and Zervox thx. Both your methods works :-) Tho I like Zervox method better.
|
|
02-19-2012 03:28 PM |
|
neo22
Member
|
RE: from std::string to EE::Str8
The Zervox's method is certainly far more effective than mine.
Thank you for teaching me this.
|
|
02-22-2012 03:42 PM |
|