LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-28-2005, 02:03 AM   #1
koldun
LQ Newbie
 
Registered: Feb 2005
Location: Russia, Tyumen
Posts: 20

Rep: Reputation: 0
Question little programming trouble


Hi. My file is (for example) :

dima:ghjgh
katya:hgjf
anya:ghjgfh
alena:fghjghj
....
so, ineed that in my screed i only got names( not :sdgdf... ). Which way i can do that?
thanks.
 
Old 02-28-2005, 02:36 AM   #2
gr33ndata
Member
 
Registered: Aug 2003
Location: DMZ
Distribution: Ubuntu
Posts: 144

Rep: Reputation: 15
Can you paste your code here so that we can figure out what's going wrong and give you a hand
 
Old 02-28-2005, 02:39 AM   #3
koldun
LQ Newbie
 
Registered: Feb 2005
Location: Russia, Tyumen
Posts: 20

Original Poster
Rep: Reputation: 0
void Form1::init()
{
QFile z("text.txt"); //file
if ( z.open(IO_ReadOnly) ) {
QTextStream t( &z );
QString a;
while ( !t.eof() ) {
a = t.readLine();
cb1->insertItem(a); // isert lines into ComboBox
}
z.close();
 
Old 02-28-2005, 02:48 AM   #4
koldun
LQ Newbie
 
Registered: Feb 2005
Location: Russia, Tyumen
Posts: 20

Original Poster
Rep: Reputation: 0
so my combobox do that :

Dima:dasda
Nadya:fsdfsdf
Masha:vcbv
....

I need:

Dima
Nadya
Masha
....

Sorry for my English
 
Old 02-28-2005, 06:36 AM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
Look for :
QString::remove ( const QRegExp & rx )

whith a QRegExp like
QRegExp rx( "/\:.*/" );
 
Old 03-02-2005, 04:57 AM   #6
koldun
LQ Newbie
 
Registered: Feb 2005
Location: Russia, Tyumen
Posts: 20

Original Poster
Rep: Reputation: 0
thanks. i fond the way:
QString b;
...
b = t.readLine();
b.truncate(b.find(":"));
...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
which programming language is used to do tcp/ip programming?? gajaykrishnan Linux - Networking 9 12-21-2012 05:16 AM
Difference between Top Down programming & Bottom up programming minil Programming 1 06-17-2005 02:42 AM
trouble ahead, trouble behind....trouble with mplayer Goonie Linux - Software 3 07-02-2003 02:29 AM
Kernel Trouble (Not actually trouble though) chem1 Linux - General 4 10-01-2002 01:10 AM
C and C++ programming rao Linux - Software 10 07-01-2002 06:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration