我是Qt Creator的新手。我想将QString
值转换为long
号。我该怎么做?
long s;
QString x = "6458621237";
编辑结果,我将得到
long s = 6458621237
; 最佳答案
使用toLong函数。
例如,
QString str = "FF";
bool ok;
long hex = str.toLong(&ok, 16); // hex == 255, ok == true
long dec = str.toLong(&ok, 10); // dec == 0, ok == false
关于c++ - 怎么把Qstring转换成Long?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6844701/