0

I'm new to qt I want to know how I can split a string into substrings with one or more operation. This is an example

QString FileName = "ABCD_1234_5678.exe";

I want this output or substrings: "ABCD" "1234" "5678"`

The QString in my application represents the name of a file that I have read with QDir::entryInfoList

Pourya
  • 92
  • 1
  • 10
pablodepas87
  • 197
  • 1
  • 16

1 Answers1

0

You can use this:

QString FileName = "ABCD_1234_5678.exe";
QString FileNameWithoutExtention = FileName.split('.')[0];
QStringList SubStrings = FileNameWithoutExtention.split('_');
qDebug()<<SubStrings;
Pourya
  • 92
  • 1
  • 10