Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8622871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:09:20+00:00 2026-06-12T07:09:20+00:00

I have a line in a file which is like this: DEF PatientLoadView Group

  • 0

I have a line in a file which is like this:

DEF PatientLoadView Group {

I am trying to parse the file to get the word after the word “DEF” in the above line.
I am trying to find split the line using string.split() and then use indexOf function of QStringList class to find the index of “DEF” and then get the word next to it. But the indexOf function returns -1 for this line. For other such lines, it returns correct value. What could be the problem?
My code is as follows:

QString line = in.readLine();
if(line.contains("DEF"))
{
    QStringList lineSplit = line.split(" ");
    int index = lineSplit.indexOf("DEF",0);
    QString nodeName = lineSplit[index+1];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:09:21+00:00Added an answer on June 12, 2026 at 7:09 am

    I found the cause of the problem – the line starts with a tab ‘\t’ and that was being part of the string that I read in. Removing this tab character worked fine for me and I am now able to get the correct results.

    Thank you for the help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a text file which has a particular line something like sometext sometext
I have one line in php file like this: <a class=hide-if-no-js onclick=findPosts.open( 'media[]','<?php echo
I have a save function within my Python program which looks like this: def
I have some VTK-files, which look like this: # vtk DataFile Version 1.0 Line
I currently have a huge HTML file which doesn't have line breaks and just
I have a file in which each line contains two numbers. The problem is
I have a file from which i read line by line and i have
I have a long single-line CSS file that I would like to convert using
I have a Model in an existing Datastore. Which looks like this: class SomeKind(db.Model):
I have an excel file which I am trying to put into mysql. There

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.