[Vala] How to get a const substring without copying?
- From: PCMan <pcman tw gmail com>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] How to get a const substring without copying?
- Date: Sun, 6 Nov 2011 22:44:14 +0800
Hello,
It's me again.
In C language, sometimes we do this:
char* uri = "ftp://140.112.172.1";
char* ip = str + 6; // get the IP part of the string without copying.
With vala, either string.substring() or string[start:end] needs copying.
Is it possible to do the above in vala? In trivial cases this causes no
difference.
However, for more performance critical code, this can reduce many
unnecessary malloc/free.
Is this possible in Vala anyways?
I cannot find any clues in the tutorials and the docs.
Thanks
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]