[#boost-urls-url_view_base-encoded_user]
= xref:boost.adoc[boost]::xref:boost/urls.adoc[urls]::xref:boost/urls/url_view_base.adoc[url&lowbar;view&lowbar;base]::encoded&lowbar;user
:relfileprefix: ../../../
:mrdocs:

Return the user

== Synopsis

Declared in `&lt;https://www.github.com/boostorg/url/blob/develop/include/boost/url/url_view_base.hpp#L884[boost&sol;url&sol;url&lowbar;view&lowbar;base&period;hpp]&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
xref:boost/urls/pct_string_view.adoc[pct&lowbar;string&lowbar;view]
encoded&lowbar;user() const noexcept;
----

== Description

If present, this function returns a string representing the user (which may be empty)&period; Otherwise it returns an empty string&period; The returned string may contain percent escapes&period;

== Example
[,cpp]
----
assert( url_view( "http://jane%2Ddoe:pass@example.com" ).encoded_user() == "jane%2Ddoe" );
----
== Complexity
Constant&period;

== Exception Safety
Throws nothing&period;

== 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 as a string&period;

== See Also

xref:boost/urls/url_view_base/has_password.adoc[`has&lowbar;password`], xref:boost/urls/url_view_base/has_userinfo.adoc[`has&lowbar;userinfo`], xref:boost/urls/url_view_base/encoded_password.adoc[`encoded&lowbar;password`], xref:boost/urls/url_view_base/encoded_userinfo.adoc[`encoded&lowbar;userinfo`], xref:boost/urls/url_view_base/password.adoc[`password`], xref:boost/urls/url_view_base/user.adoc[`user`], xref:boost/urls/url_view_base/userinfo.adoc[`userinfo`]&period;


[.small]#Created with https://www.mrdocs.com[MrDocs]#
