Skip to content
FutureBlitz

    Install

    Import std.net.url

    QueryParams

    std.net.url

    class

    Public Class QueryParams Implements Printable, Iterable<(String, String)>

    A query's names and values, in order, as an HTML form sends them: "a=1&b=two%20words", where a + is a space. One name can have many values.

    Examples

    Local query = QueryParams("q=two%20words&page=2")
    Expect(query.Get("q") == "two words")
    query.Set("page", "3")
    query.Add("tag", "a&b")
    Expect("{query}" == "q=two+words&page=3&tag=a%26b")

    std/net/url.fb, line 207

    • Public New() constructor #

      A new, empty QueryParams.

    • Public New(query: String) constructor #

      The names and values query has, after its ?, if it starts with one.

    • Public Property Count: Int property #

      How many pairs it has.

    • Public Method Get(name: String): String? method #

      The first value of name, or Null when it has none.

    • Public Method GetAll(name: String): String[] method #

      Each value of name, in order.

    • Public Method Contains(name: String): Bool method #

      Whether it has name, or name with value.

    • Public Method Contains(name: String, value: String): Bool method #

      Whether it has name with value.

    • Public Method Add(name: String, value: String) method #

      Adds name and value at the end, after any values name has.

    • Public Method Set(name: String, value: String) method #

      Gives name value: its first pair's, taking the others out, or a new one at the end.

    • Public Method Remove(name: String): Bool method #

      Takes out each pair of name, or of name and value, and gives whether there was one.

    • Public Method Remove(name: String, value: String): Bool method #

      Takes out each of name's values that are value, and tells whether it had any.

    • Public Method Sort() method #

      Puts the pairs in the order of their names, by UTF-16 code units, as the standard says, keeping the order of one name's values: a merge sort, by each name's order worked out once.

    • Public Method Iterate(): ArrayIterator<(String, String)> method #

      Each name and value, in order.

    • Public Method ToString(): String method #

      The query's text, without a ?: each name, =, and value, with & between pairs, a space as a +, and what isn't a letter, a digit, or one of *-._ percent-encoded.

    Report an issue with this page or with FutureBlitz on GitHub.