Why do they have a System::String
and a std::string
in c++?
I couldn't find anything about this, except some topics about converting the one to another.
I noticed this when I want to put information of a textbox
into a std::string
variable. so I had to do some odd converting to get this.
Why do they have these 2 different strings when they actually do the same for coding? (holding a string value).
std::string
is a class template from the c++ standard library that stores and manipulates strings. The data in std::string
is basically a sequence of bytes, i.e. it doesn't have en encoding. std::string
supports the most basic set of operations that you would expect from a string, namely it gives you methods for substring search and replace.
System::string
is a class from Microsoft's .Net framework. It represents text as a series of Unicode characters, and has some more specialized methods like StartsWith
, EndsWith
, Split
, Trim
, ans so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With