boost::urls::static_url::set_encoded_user :: Boost Libraries Documentation

# boost::urls::static_url::set_encoded_user

Set the user

## Synopsis

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

    static_url&
    set_encoded_user(pct_string_view s);

## Description

This function sets the user part of the userinfo the the string, which may contain percent‐escapes. Escapes in the string are preserved, and reserved characters in the string are percent‐escaped in the result.

## Example

    assert( url().set_encoded_user("john%20doe").userinfo() == "john doe" );

## Postconditions

    this->has_authority() == true && this->has_userinfo() == true

## Complexity

Linear in `this‐>size() + s.size()`.

## Exception Safety

Strong guarantee. Calls to allocate may throw.

## BNF

    userinfo      = [ [ user ] [ ':' password ] ]

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

## Specification

- 3.2.1. User Information (rfc3986)

## Return Value

`*this`

## Parameters

Name | Description
s | The string to set.

## See Also

`remove_password`, `set_encoded_password`, `set_password`, `set_user`.

Created with MrDocs