Strings

Martin Piskernig martin.piskernig at stuwo.at
Wed Feb 9 21:57:29 GMT 2000


On Wed, 09 Feb 2000, you wrote:
> Hi,
> 
> I have a little question about strings:
> I want to take a piece of a string and put it in a new variable.
> 
> QString file_info = "-rw-rw-r--   1 saar     saar        11 Jan  5 22:00 somefile.txt";
> 
> I want to take "-rw-rw-r--" (For example) and put it in a new variable.

There are different ways to do this, but you should especially look for the
QString::left(),::mid(),::right() and ::find() methods in the Qt Documentation. 
For your example: QString file_perm = file_info.left(10); gets the 10 
left-most characters (= the file permissions)
-- 
Martin Piskernig
<martin.piskernig at stuwo.at>    ICQ: 24015591
The KDevelop Team           www.kdevelop.org




More information about the KDevelop mailing list