2008-11-24 Jürg Billeter <j@bitron.ch>
* vapi/glib-2.0.vapi:
Add string.replace method, patch by Ali Sabil
svn path=/trunk/; revision=2062
+2008-11-24 Jürg Billeter <j@bitron.ch>
+
+ * vapi/glib-2.0.vapi:
+
+ Add string.replace method, patch by Ali Sabil
+
2008-11-24 Jürg Billeter <j@bitron.ch>
* ccode/valaccodefunctioncall.vala:
/* internal method */
public string substring (long offset, long len);
+ public string replace (string old, string replacement) {
+ try {
+ var regex = new GLib.Regex (GLib.Regex.escape_string (old));
+ return regex.replace_literal (this, -1, 0, replacement);
+ } catch (GLib.RegexError e) {
+ GLib.assert_not_reached ();
+ }
+ }
+
public long length {
get { return this.len (); }
}