Example: Convert a URI to string

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: ``http://username@localhost:8088/foo/bar.html?foo=f&bar=b#frag``
string uri_str1 = uri.to_string (false);
print ("%s\n", uri_str1);

// Output: ``/foo/bar.html?foo=f&bar=b``
string uri_str2 = uri.to_string (true);
print ("%s\n", uri_str2);

return 0;
}

 valac --pkg libsoup-2.4 uri-to-string.vala

See:




2022 vala-language.org