I've noticed that there appears to be no 'find' method available within the string class, although in C itself it appears to be present under ustring. We still have replace and substring methods, however (which seems to imply that the addition of find would be entirely possible). Is a change in order? Is there a reason it's not there?

Here's an example of what I mean by the find method, if you're not familiar:

string myString="This is my string!";
int substrPostition=myString.find(" is ");
int substrPosition2=myString.find("something else");
//substrPosition should equal 4
//substrPosition2 should equal -1, since that text was not within the string.

If you're wondering why I need this it's because I need to apply texttags to marked up text coming in from a .txt file. I need to know the integer positions of the marked up text (for the textbuffer) in order to apply the tags in this manner as the text comes in. This is so I can have italics/bold/underline in my e-book reader. It's not an editor (an editor would not require this, except maybe for opening files). If you know another way that will work, feel free to mention it. As far as writing a find method myself goes, is that even possible in pure Vala? And if so (as with iterating over string characters and …), would it be as efficient as the find method usually is? Just wondering. Thanks!
_______________________________________________
vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to