java字符串替换空格位
时间: 2023-07-18 12:42:03 浏览: 95
case InfoDesc:
case ChannelType:
QStyledItemDelegate::setModelData(editor, model, index);
break;
case YXBit:
case ConfirmStatus:
case Confirm:
model->setData(index, static_cast<QCheckBox*>(editor)->isChecked在Java中,可以使用String类的replace()方法替换字符串中的空格。具体方法如下:
```
String(), Qt::EditRole);
break;
case ActionTime:
case RestoreTime:
case ConfirmTime:
model->setData str = "This is a string with spaces.";
String newStr = str.replace(" ", "%20");
System.out.println(newStr);
```
(index, static_cast<QDateTimeEdit*>(editor)->dateTime(), Qt::EditRole);
break;
}
}
void YX_INFO_Delegate这段代码会将字符串中的空格替换为"%20",输出结果为"This%20is%20a%20string%20with%20spaces."。
阅读全文