uri

Generated by tinox doc

URI/URL parsing and percent-encoding. Uri::parse splits a scheme://host/path?query#fragment URL into its parts (UriParts); Uri::encode/decode percent-encode or decode a whole URI (reserved characters left alone), Uri::encodeComponent/decodeComponent do the same for a single component (e.g. a query parameter value, where reserved characters must also be escaped).

Parse and encode

import tinox.core.uri;

class Main
{
    fnc main() -> Int32
    {
        let parts: UriParts = Uri::parse("https://example.com/search?q=tinox+lang#top");
        println(parts.scheme);
        println(parts.host);
        println(parts.path);
        println(parts.query);
        println(parts.fragment);

        let encoded: String = Uri::encodeComponent("hello world & more");
        println(encoded);
        println(Uri::decodeComponent(encoded));

        return 0;
    }
}

fn tinoxBytesToString(bytes: List<Int64>) → String

class Uri

Methods

fn isUnreserved(code: Int64) → Bool
fn isReserved(code: Int64) → Bool
fn hexDigit(n: Int64) → String
fn percentEncodeByte(code: Int64) → String
fn hexValue(c: String) → Int64
fn encodeComponent(s: String) → String
fn encode(s: String) → String
fn decodeComponent(s: String) → String
fn decode(s: String) → String
fn parse(url: String) → UriParts

class UriParts

Fields

schemeString
hostString
pathString
queryString
fragmentString