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

  Pi Ke        2011-12-15 12:47:22       22,485        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.


C++  CLR  MICROSOFT  SYSTEM::STRING  CONVERT  INT 

           

  RELATED


  2 COMMENTS


sonic
Feb 8, 2012 at 9:51 am
This is exactly what I want
Anonymous
Aug 8, 2019 at 4:39 am

Thanks a lot!



  RANDOM FUN

Unexpected behavior due to a bug


  SUPPORT US