C++/CLR int to System::String^

  Pi Ke        2011-12-15 12:47:22       22,296        2    

In C++/CLR (for Microsoft), sometimes we need to convert int to System::String type or vice versa. The simple way is :

From System::String^ to int
Sign In to Vote

int num= int::Parse(str); // System::String^ to int

From int to System::String^

System::String^ str = num.ToString(); // int to System::String^

For all the other data types, similar ways can be adopted.


MICROSOFT  C++  CLR  SYSTEM::STRING  CONVERT  INT 

       

  RELATED


  2 COMMENTS


sonic [Reply]@ 2012-02-08 09:51:18
This is exactly what I want
Anonymous [Reply]@ 2019-08-08 04:39:13

Thanks a lot!



  RANDOM FUN

Can you give a title?

Is this encapsulation? Or soemthing else?