Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

why do they have a system string and standard string

Tags:

c++

string

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).

like image 626
Bart Avatar asked Oct 12 '25 10:10

Bart


1 Answers

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.

like image 170
SingerOfTheFall Avatar answered Oct 14 '25 23:10

SingerOfTheFall