Set the user

Synopsis

Declared in header </boost/url/url_base.hpp#L625[boost/url/url_base.hpp,window=blank_]>

url_base&
set_user(string_view s);

Description

This function sets the user part of the userinfo to the string. Any special or reserved characters in the string are automatically percent-encoded.

Example

assert( url().set_user("john doe").encoded_userinfo() == "john%20doe" );

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 / ":" )

Return Value

  • ``

Parameters

Name Type

s

string_view