[#680D50F4D016E3F4E71B749785EE24D66341E679]

Function url_view_base:: fragment

Return the fragment

Synopsis

            template
StringToken::result_type
fragment(StringToken&& token) const;
        

Description

This function calculates the fragment of the url, with percent escapes decoded and without the leading pound sign ('#') whose presence indicates that the url contains a fragment.

This function accepts an optional StringToken parameter which controls the return type and behavior of the function:

  • When called with no arguments, the return type of the function is `std::string`. Otherwise
  • When called with a string token, the behavior and return type of the function depends on the type of string token being passed.
  • Example

    assert( url_view( "http://www.example.com/index.htm#a%2D1" ).fragment() == "a-1" );

    Complexity

    Linear in `this->fragment().size()`.

    Exception Safety

    Calls to allocate may throw. String tokens may throw exceptions.

    BNF

    fragment = *( pchar / "/" / "?" ) fragment-part = [ "#" fragment ]

    Specification

  • 3.5. Fragment (rfc3986)