[#boost-urls-authority_view-user] = xref:boost/urls/authority_view/user.adoc[boost::urls::authority_view::user] :relfileprefix: ../../../ :mrdocs: Return the user == Synopsis Declared in `<https://www.github.com/boostorg/url/blob/develop/include/boost/url/authority_view.hpp#L468[boost/url/authority_view.hpp]>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- template<xref:boost/urls/string_token/StringToken.adoc[string_token::StringToken] StringToken = xref:boost/urls/string_token/return_string.adoc[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 [,cpp] ---- 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 [,cpp] ---- 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 == Parameters [cols=2] |=== | Name | Description | *token* | A string token to receive the result. |=== == See Also xref:boost/urls/authority_view/has_password.adoc[`has_password`], xref:boost/urls/authority_view/has_userinfo.adoc[`has_userinfo`], xref:boost/urls/authority_view/encoded_password.adoc[`encoded_password`], xref:boost/urls/authority_view/encoded_user.adoc[`encoded_user`], xref:boost/urls/authority_view/encoded_userinfo.adoc[`encoded_userinfo`], xref:boost/urls/authority_view/password.adoc[`password`], xref:boost/urls/authority_view/userinfo.adoc[`userinfo`]. [.small]#Created with https://www.mrdocs.com[MrDocs]#