boost::urls::url_view_base::user :: Boost Libraries Documentation

# boost::urls::url_view_base::user

Return the user

## Synopsis

Declared in `<boost/url/url_view_base.hpp>`

    template<string_token::StringToken StringToken = string_token::return_string>
    StringToken::result_type
    user(StringToken&& token = {});

## Description

If present, this function returns a string representing the user (which may be empty). Otherwise it returns an empty string. Any percent‐escapes in the string are decoded first.

## Example

    assert( url_view( "http://jane%2Ddoe:pass@example.com" ).user() == "jane-doe" );

## Complexity

Linear in `this‐>user().size()`.

## Exception Safety

Calls to allocate may throw.

## BNF

    userinfo    = user [ ":" [ password ] ]

    user        = *( unreserved / pct-encoded / sub-delims )
    password    = *( unreserved / pct-encoded / sub-delims / ":" )

## Specification

- https://datatracker.ietf.org/doc/html/rfc3986#section-3.2.1

## Return Value

The user as a string.

## Parameters

Name | Description
token | The string token to use.

## See Also

`has_password`, `has_userinfo`, `encoded_password`, `encoded_user`, `encoded_userinfo`, `password`, `userinfo`.

Created with MrDocs