set_fragment


Description:

public void set_fragment (string? fragment)

Sets this's fragment to fragment.

Example: Set and get the fragment:

public static int main (string[] args) {
Soup.URI uri = new Soup.URI ("http://username:password@localhost:8088/foo/bar.html?foo=f&bar=b#frag");

// Output: ``Fragment: frag``
unowned string fragment = uri.get_fragment ();
print ("Fragment: %s\n", fragment);

// Output: ``URI: http://username@localhost:8088/foo/bar.html?foo=f&bar=b#fragment``
uri.set_fragment ("fragment");
string uri_str = uri.to_string (false);
print ("URI: %s\n", uri_str);

return 0;
}

valac --pkg libsoup-2.4 uri-fragment.vala

Parameters:

this

a URI

fragment

the fragment




2022 vala-language.org