About Store Forum Documentation Contact



Post Reply 
from std::string to EE::Str8
Author Message
komarEX Offline
Member

Post: #1
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
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #2
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
Visit this user's website Find all posts by this user Quote this message in a reply
komarEX Offline
Member

Post: #3
RE: from std::string to EE::Str8
TBJokers, read my post again also topic name.
02-17-2012 09:56 PM
Find all posts by this user Quote this message in a reply
TBJokers Offline
Member

Post: #4
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
Visit this user's website Find all posts by this user Quote this message in a reply
komarEX Offline
Member

Post: #5
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
Find all posts by this user Quote this message in a reply
komarEX Offline
Member

Post: #6
RE: from std::string to EE::Str8
Anyone?
02-19-2012 12:45 PM
Find all posts by this user Quote this message in a reply
neo22 Offline
Member

Post: #7
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
Visit this user's website Find all posts by this user Quote this message in a reply
Zervox Offline
Member

Post: #8
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
Find all posts by this user Quote this message in a reply
komarEX Offline
Member

Post: #9
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
Find all posts by this user Quote this message in a reply
neo22 Offline
Member

Post: #10
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
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply