advantage of QString over std::string

QString allows you to work with Unicode, has more useful methods and integrates with Qt well. It also has better performance, as cbamber85 noted.

std::string just stores the bytes as you give them to it, it doesn’t know anything about encodings. It uses one byte per character, but it’s not enough for all the languages in the world. The best way to store your texts would probably be UTF-8 encoding, in which characters can take up different number of bytes, and std::string just can’t handle that properly! This, for example, means that length method would return the number of bytes, not characters. And this is just the tip of an iceberg…

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)