Answers for "qstring to string"

3

how to convert qt string to string

QString qs;
// do things
std::cout << qs.toStdString() << std::endl;
Posted by: Guest on February-14-2020
1

std::string to qstring

QString str = QString::fromUtf8(content.c_str());
Posted by: Guest on June-11-2020
7

.includes( string

var str = "Hello world, welcome to the universe.";
var n = str.includes("world");
Posted by: Guest on November-14-2019
0

typeid to string c++

#include <string>
#include <typeinfo>
#include <iostream>

using namespace std;

int main(int argc, char** argv) {
    string str = "string";
    cout << typeid(str).name();
    return 0;
}
Posted by: Guest on May-03-2020
-2

qstring to string

QString qs;

// Either this if you use UTF-8 anywhere
std::string utf8_text = qs.toUtf8().constData();

// or this if you're on Windows :-)
std::string current_locale_text = qs.toLocal8Bit().constData();
Posted by: Guest on December-28-2020

Browse Popular Code Answers by Language