| #include "widget.h" |
| #include "ui_widget.h" |
| |
| Widget::Widget(QWidget *parent) |
| : QWidget(parent) |
| , ui(new Ui::Widget) |
| { |
| ui->setupUi(this); |
| } |
| |
| Widget::~Widget() |
| { |
| delete ui; |
| } |
| |
| void Widget::on_btnAppend_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| str1 = str1.append(str2); |
| ui->editResult->setText(str1); |
| } |
| |
| void Widget::on_btnPrepend_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| str1 = str1.prepend(str2); |
| ui->editResult->setText(str1); |
| } |
| |
| void Widget::on_btnUpper_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| str1 = str1.toUpper(); |
| ui->editResult->setText(str1); |
| } |
| |
| void Widget::on_btnLower_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| str1 = str1.toLower(); |
| ui->editResult->setText(str1); |
| } |
| |
| void Widget::on_btnLeft_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| int number = ui->spinBoxResult->value(); |
| str1 = str1.left(number); |
| ui->editResult->setText(str1); |
| } |
| |
| void Widget::on_btnRight_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| int number = ui->spinBoxResult->value(); |
| str1 = str1.right(number); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| void Widget::on_btnSection_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| int number = ui->spinBoxResult->value(); |
| str1 = str1.section(str2.data()[0],number,number +1); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnSimplified_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| str1 = str1.simplified(); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnTirm_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| str1 = str1.trimmed(); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnCount_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| int count = str1.count(); |
| ui->editResult->setText(str1.setNum(count)); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnSize_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| int size = str1.size(); |
| ui->editResult->setText(str1.setNum(size)); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_binIndexOf_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| int index = str1.indexOf(str2); |
| str1 = str1.setNum(index); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnLastIndex_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| int index = str1.lastIndexOf(str2); |
| str1 = str1.setNum(index); |
| ui->editResult->setText(str1); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnEndWith_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| bool result = str1.endsWith(str2); |
| ui->checkBoxResult->setText(qobject_cast<QPushButton *>(sender())->text()); |
| ui->checkBoxResult->setChecked(result); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnStartsWith_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| bool result = str1.startsWith(str2); |
| ui->checkBoxResult->setText(qobject_cast<QPushButton *>(sender())->text()); |
| ui->checkBoxResult->setChecked(result); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnContains_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| str2 = ui->comboBoxStr2->currentText(); |
| bool result = str1.contains(str2); |
| ui->checkBoxResult->setText(qobject_cast<QPushButton *>(sender())->text()); |
| ui->checkBoxResult->setChecked(result); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnIsNull_clicked() |
| { |
| QString str1 = ui->comboBoxStr1->currentText(); |
| bool result = str1.isNull(); |
| ui->checkBoxResult->setText(qobject_cast<QPushButton *>(sender())->text()); |
| ui->checkBoxResult->setChecked(result); |
| } |
| |
| |
| |
| |
| |
| void Widget::on_btnIsEmpty_clicked() |
| { |
| QString str1 ,str2; |
| str1 = ui->comboBoxStr1->currentText(); |
| bool result = str1.isEmpty(); |
| ui->checkBoxResult->setText(qobject_cast<QPushButton *>(sender())->text()); |
| ui->checkBoxResult->setChecked(result); |
| } |
| |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· winform 绘制太阳,地球,月球 运作规律
· AI与.NET技术实操系列(五):向量存储与相似性搜索在 .NET 中的实现
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)