Re: [Vala] Need help with string
- From: Abderrahim Kitouni <a kitouni gmail com>
- To: Nicolas <c r n a wanadoo fr>
- Cc: vala-list gnome org
- Subject: Re: [Vala] Need help with string
- Date: Thu, 3 Sep 2009 10:59:32 +0100
Hi,
2009/9/3 Nicolas <c r n a wanadoo fr>:
That's the problem, I have a text file, but at a certain place there is, for
example, the code [INFO] and I need to read everything that comes after this
code, which in fact is just text !
Maybe you just want FileUtils.get_contents [1], it will return a
string that you can use as you like
string contents;
try {
FileUtils.get_contents(filename, out contents);
} catch (FileError) {
//handle appropriately
}
var info = contents.str('[INFO]');
if (info != null) {
var needed_text = info.substring('[INFO]'.length);
// do what you want with this
}
I haven't compiled this code, so there may be some problems with it,
but the idea is there.
HTH,
Abderrahim
[1] http://references.valadoc.org/glib-2.0/GLib.FileUtils.get_contents.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]